Change once, changee all...

bigtree

New Member
Messages
82
Reaction score
0
Points
0
I'm trying to make it so that I can edit my menu in a seperate file and have it change in all my pages. I don't want to use frames. For example, my menu is in every page, and in the script for the pages it says something like <script source="blah"> type thing, and when I change the "blah" file, it changes the menu on all the pages... Is this possible? Does this even make sense?
Edit:
Oh, come on, there has to be some solution!
 
Last edited:

xmakina

New Member
Messages
264
Reaction score
0
Points
0
What you want is PHP include or require. These commands allow you to place one file into another.

Example: You want a standard header and title in every page:

Put in your page:
PHP:
<?php
include("title.php");
?>

Then create a file called "title.php" (for this example at least) and place in it the code you want where the include is. In our case it's:
HTML:
<title>My Website</title>
 

quantum1

New Member
Messages
68
Reaction score
0
Points
0
Is your menu straight HTML or does it include <?php ?> tags, also? Also, does it contain javascript or references to javascript that is dependent on tag names or ids?
 

dickey

New Member
Messages
128
Reaction score
0
Points
0
yes you can do that. with javascript and/or php depending if you have the actual script already.

judging by what you actually typed I am assuming you have an existing javascript menu, is this right? You will have to write the whole menu and save it into one file e.g. blah. then include it to your html using <script type='text/javascript' src='blah'></script> I am not quite sure but I think in javascript you will use document.write("menu code") to the insert your menu to your page.

but if you are asking for opinion php will work easiest. Create your php menus. and just use include 'blah.php'; and you are all set.
Edit:
if you want a pure css - html dropdown menu I can also help you with that.
 
Last edited:

bigtree

New Member
Messages
82
Reaction score
0
Points
0
I tried the php includem thing and...
It works! Merci!
 
Last edited:
Top