Results 1 to 8 of 8

Thread: Is it PHP?

  1. #1

    Thread Starter
    Fanatic Member duc's Avatar
    Join Date
    Oct 2002
    Location
    STEAM
    Posts
    702

    Is it PHP?

    How can I keep menu's from other parts of my site [the home page menu] on other pages without copying and pasting the same code on each page? You dont have to tell me if you can tell me what its called and then i can search the forums.

    -duc

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    use the include() function

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    PHP Code:
    include("/menu.php"); 
    That simple.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    SSI (Server Side Includes) can do such a simple thing too and are easier to install and use and are served faster.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Fanatic Member duc's Avatar
    Join Date
    Oct 2002
    Location
    STEAM
    Posts
    702
    Originally posted by mendhak
    PHP Code:
    include("/menu.php"); 
    That simple.
    Where do I put that in my source? [btw nice site ]

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You have a file called menu.php or menu.html, whatever you want, that has your menu in it.

    Then in your pages, you have to do the:

    Code:
    include 'menu.html';
    The pages that have the above code in them must be .php documents. The only difference between a .php and a .html document is the extension, and the fact that you can have php code in the first.

    What I usually do is have a header.html and footer.html file, and in each of my pages I have:

    Code:
    <?php include 'header.html'; ?>
    
    <b>All the HTML</b> stuff here.
    
    <?php include 'footer.html'; ?>
    It makes it really easy to update layouts, menus, etc.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by duc
    Where do I put that in my source? [btw nice site ]
    Thanks.

    Like the Hobo said. It really depends upon *what* it actually is. If it's a table, like you have on your site, you'd include that in place of, or inside some <td>. It could be a header you want uniform on all your pages, so that'd be right at the beginning.

    HTH.

    BTW, your's is potentially funny too. What are you going to be using it for?

  8. #8

    Thread Starter
    Fanatic Member duc's Avatar
    Join Date
    Oct 2002
    Location
    STEAM
    Posts
    702
    Originally posted by mendhak
    Thanks.

    Like the Hobo said. It really depends upon *what* it actually is. If it's a table, like you have on your site, you'd include that in place of, or inside some <td>. It could be a header you want uniform on all your pages, so that'd be right at the beginning.

    HTH.

    BTW, your's is potentially funny too. What are you going to be using it for?
    I'm not so sure. Maybe just for fun? To put my thoughts on the web. Downloads here n there. Right now im trying to find a good chat for everyone to talk in. But I need to fix my Jva first! .
    I like the idea...of...[just remembers he had message boards on his old site and forgot to upload them on the new one...] see ya!

    Thanks Mendhak.

    -Duc <-----I like!

Posting Permissions

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



Click Here to Expand Forum to Full Width