Results 1 to 5 of 5

Thread: SD-Menu for site-wide use

  1. #1
    Join Date
    May 2009
    Location
    Tybee Island Georgia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SD-Menu for site-wide use

    1) Script Title: SDmenu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/slashdot.htm

    3) Describe problem:
    I can't figure out how to call upon the menu links contents of the sdmenu script from one location, so that there doesn't have to be a duplicate copy of the script on every page of the site...

    I'm not sure if Im wording my question is clear -- But the objective is to have only one source file (like a js file) containing the links of the menu that all pages can use -- so that don't have to edit every page of the site everytime I change the navigation links.

    I suspect this may be an ignorant question, but I have searched Dynamic drive and the net trying to find the answer, but still don't know what to do.

    Thanks for any assistance. Even a link to a tutorial would be of great help.

    Rich

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    If you have PHP enabled on your server, you could use include().

    Good luck!

  3. #3
    Join Date
    May 2009
    Location
    Tybee Island Georgia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Snookerman View Post
    If you have PHP enabled on your server, you could use include().

    Good luck!
    Thanks for the reply Snooker.
    I will have to learn about php (I know little currently).. Frankly, I'm little more than a copy-n-paste man.

    Is my immediately learning php techniques the only method to edit all my navigational menus from one file?
    I have this sd-menu spread across a whole slew of pages and there are numerous links needing change.

    I guess what I'm asking for is an example to cut and paste.. any chance of that happening?

    Thanks again

    Rich

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    It's actually not that difficult. Just put all the code you need for the menu into a separate file, can even be a txt file:
    HTML Code:
        <div style="float: left" id="my_menu" class="sdmenu">
          <div>
            <span>Online Tools</span>
            <a href="http://tools.dynamicdrive.com/imageoptimizer/">Image Optimizer</a>
            <a href="http://tools.dynamicdrive.com/favicon/">FavIcon Generator</a>
            <a href="http://www.dynamicdrive.com/emailriddler/">Email Riddler</a>
            <a href="http://tools.dynamicdrive.com/password/">htaccess Password</a>
            <a href="http://tools.dynamicdrive.com/gradient/">Gradient Image</a>
            <a href="http://tools.dynamicdrive.com/button/">Button Maker</a>
          </div>
          <div>
            <span>Support Us</span>
            <a href="http://www.dynamicdrive.com/recommendit/">Recommend Us</a>
            <a href="http://www.dynamicdrive.com/link.htm">Link to Us</a>
            <a href="http://www.dynamicdrive.com/resources/">Web Resources</a>
          </div>
          <div class="collapsed">
            <span>Partners</span>
            <a href="http://www.javascriptkit.com">JavaScript Kit</a>
            <a href="http://www.cssdrive.com">CSS Drive</a>
            <a href="http://www.codingforums.com">CodingForums</a>
            <a href="http://www.dynamicdrive.com/style/">CSS Examples</a>
          </div>
          <div>
            <span>Test Current</span>
            <a href="?foo=bar">Current or not</a>
            <a href="./">Current or not</a>
            <a href="index.html">Current or not</a>
            <a href="index.html?query">Current or not</a>
          </div>
        </div>
    and save it as menu.txt for instance.

    Then all you need to do is add this code on the pages where you want the menu to appear:
    PHP Code:
    <?php include'menu.txt'?>
    You also have to change the extension of all pages to .php if you don't have that already.

    Good luck!

  5. #5
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    If you cannot use PHP, you could use this. There's a link to demos on the page.
    ===
    Arie.

Bookmarks

Posting Permissions

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