+ Post New Thread
Results 1 to 3 of 3
Web Development Thread, How to modularize CSS menus in Coding and Web Development; hi all, Here's a question to be sure: how do I modularize CSS menus? In other words, I want to ...
  1. #1

    Join Date
    Jan 2009
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    How to modularize CSS menus

    hi all,

    Here's a question to be sure: how do I modularize CSS menus? In other words, I want to define a menu (e.g., orange Tree Horizontal Menu) once, and then call/invoke it from any number of pages. Is this possible, or must I duplicate the HTML code in every page? Seems to me that last method would be inefficient, since a change to the menu would require a change to each and every page. Please help me.

    Thanks
    ------------------------------
    software development company

  2. #2

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    289
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    If you create the menu's css in an external file. You can call that css page from any page. You would have to create the divs, tables, hyperlinks etc for each page. However, just add the id of each 'object' for the css to style.

    So you might have an external css page like:
    (default.css)
    div.menu {
    background-color: #000;
    color: #f00;
    }

    Then in a the html pages you can call the default.css page.

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="default.css" />.
    <title>Page Using CSS</title>
    </head>
    <body>
    <div id="menu">My Menu</div>
    </body>
    </html>


    Hope this helps

  3. #3

    Join Date
    Oct 2008
    Location
    Gosport
    Posts
    64
    Thank Post
    1
    Thanked 18 Times in 13 Posts
    Rep Power
    15
    You would have to create the divs, tables, hyperlinks etc for each page.
    ... unless you save your pages as .php instead of .html . If you do that then you can cut/paste your menu html into a separate file (say... 'menu.html') and include it on each page :

    PHP Code:
    <html>
    <head> ... stuff (including of course linking to style sheets) ... </head>
    <body>
    <?php include 'menu.html'?>
    <div id="body-copy">
    <h1>Header</h1>
    <p>Body of your page</p>
    </div>
    </body>
    </html>
    This is assuming of course that your hosts provide php (most do these days). You have to save it as .php so that the server knows to look for <?php and ?> tags which signal the start and end of php code. "include" gets the server to replace that bit with the contents of menu.html . It's pretty straight-forward and will save you time when you go to add a new menu item or re-structure the site (as innevitably happens eventually).

    Hello
    :-Dave

SHARE:
+ Post New Thread

Similar Threads

  1. Joomla Menus
    By wesleyw in forum EduGeek Joomla 1.5 Package
    Replies: 3
    Last Post: 22nd October 2008, 09:17 AM
  2. joomla sub-menus
    By HodgeHi in forum EduGeek Joomla 1.5 Package
    Replies: 6
    Last Post: 2nd June 2008, 11:38 AM
  3. creating new menus
    By jkmoch in forum EduGeek Joomla 1.0 Package
    Replies: 2
    Last Post: 5th May 2008, 03:28 AM
  4. Menus 'pop-under'
    By kerlj001 in forum EduGeek Joomla 1.0 Package
    Replies: 10
    Last Post: 27th February 2008, 10:51 AM
  5. Renaming menus
    By ianaddisonuk in forum Web Development
    Replies: 0
    Last Post: 12th August 2007, 02:01 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •