Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: What is the best way to get my menu on every page

  1. #1
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default What is the best way to get my menu on every page

    I have had a terrible time getting logged into this program to post a question! Managed to figure out some css coding eventually of which I had never used before. I replaced a css coded menu where I used to have "frames." Now, I am wondering if there is a way to make my menu appear on all my pages without copying and pasting the css code on every page? That is, other than using "frames" again. I would like to avoid "frames" if possible.

    The website I am trying to work on is here........ http://elvispics.tripod.com/

    Andrea
    Last edited by ddadmin; 03-16-2007 at 11:00 PM.

  2. #2
    Join Date
    Mar 2007
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Here is a link to CSS Frames

    http://www.dynamicdrive.com/style/layouts/category/C11/


    But I just copied and pasted all the code on every page for my site.

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Actually, what you want is to use something like SSI (server side includes). When you see pages with a .shtml extension, that's SSI at work. Check out the following tutorial: http://www.javascriptkit.com/howto/ssi2.shtml

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP and other server side programming languages can give you more control over the process if need be. For the basics, that should work, though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Here is the php script i use for my menus...

    PHP Code:
    function menu($main) {
      
    $full file_get_contents("http://localhost/includes/menu.txt");
      
    $ready explode("\r\n"$full);
      
    $count "0";
      while ((
    $count >= "0") && ($count <= count($ready)-2)) {
        
    $one explode("|"$ready[$count]);
        if(
    $main == TRUE) {
          echo 
    "<div class=\"item\"><a href=\""$one['0'] ."\">"$one['1'] ."</a></div>\r\n<div class=\"spacer\"></div>";
        } else {
          echo 
    "<br /><a href=\""$one['0'] ."\">"$one['1'] ."</a>\r\n";
        };
        
    $count++;
      };
    }; 
    Then in menu.txt i have
    http://domain.com/url|Item name
    htp://domain.com/?page|next item name
    etc...
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    But you'd need to include that in each.

    Or you could do another layer of PHP includes, so that you use one main php page included on each page, which has already parsed the text file.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thats actually what i did, i have several includes on my main index.php file.
    but the reason i needed it as a function was to display the same links differently. (Here and Here)
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  8. #8
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    For instance, if I wanted to use this css frame layout http://www.dynamicdrive.com/style/la...-frame-layout/ would I create a filename like "menu.txt" (or what?) and put in this code and fill in the appropriate fields???

    Does this work similiar to using simple ordinary frames? I did not see any information on the page to define how to use the code.

    Andrea

  9. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Benedizione:
    You wouldn't be using CSS frames at all if what you're trying to do is include a file into multiple pages (so changing that file is reflected on all pages that carry it). CSS Frames is just a type of layout whereby a certain section of the page doesn't scroll with the rest of the content. It has nothing to do with what you're trying to accomplish here, which needs to be done via a server side technology, such as SSI or PHP. The key is what the page type of your site is- .shtml, .php, or some other server side enabled pages.

  10. #10
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    Ok, so I can use a "PHP" coding and create a page called "menu.txt" and put this code on that page:

    Then in menu.txt i have
    http://domain.com/url|Item name
    htp://domain.com/?page|next item name

    etc...

    Then where do I place the other long coding you posted? Does that go on the main page? Or every page? How do you make it work?

    Andrea

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
  •