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. :wave:
-duc
Printable View
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. :wave:
-duc
use the include() function
That simple.PHP Code:include("/menu.php");
SSI (Server Side Includes) can do such a simple thing too and are easier to install and use and are served faster.
Where do I put that in my source? [btw nice site ;) ]Quote:
Originally posted by mendhak
That simple.PHP Code:include("/menu.php");
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:
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.Code:include 'menu.html';
What I usually do is have a header.html and footer.html file, and in each of my pages I have:
It makes it really easy to update layouts, menus, etc.Code:<?php include 'header.html'; ?>
<b>All the HTML</b> stuff here.
<?php include 'footer.html'; ?>
Thanks. :afrog:Quote:
Originally posted by duc
Where do I put that in my source? [btw nice site ;) ]
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 J:mad:va first! ;).Quote:
Originally posted by mendhak
Thanks. :afrog:
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 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 :afrog: <-----I like!