|
-
Oct 20th, 2003, 08:33 PM
#1
Thread Starter
Fanatic Member
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
-
Oct 20th, 2003, 10:10 PM
#2
Frenzied Member
use the include() function
-
Oct 20th, 2003, 11:30 PM
#3
PHP Code:
include("/menu.php");
That simple.
-
Oct 21st, 2003, 05:00 AM
#4
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.
-
Oct 21st, 2003, 03:38 PM
#5
Thread Starter
Fanatic Member
Originally posted by mendhak
PHP Code:
include("/menu.php");
That simple.
Where do I put that in my source? [btw nice site ]
-
Oct 21st, 2003, 10:49 PM
#6
Stuck in the 80s
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.
-
Oct 22nd, 2003, 12:36 AM
#7
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?
-
Oct 22nd, 2003, 04:10 PM
#8
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|