Forum Moderators: open

Message Too Old, No Replies

Drop down menu - how can I easily make sitewide updates?

         

gooders2274

5:02 pm on Sep 30, 2006 (gmt 0)

10+ Year Member



I have created a drop down menu which links to about 30 pages within my site. Problem is, when I add new pages will I have to update EVERY drop box on every page? Is there an easy way of doing this please.?

This is the code I have used to create the drop down menu;

<form name="form1" method="post">

<b><small>Select</small></b>

<select name="dd1" size="1">
<option value="http://www.url.co.uk/w.htm">W</option>
<option value="http://www.url.co.uk/x.htm">X</option>
</select>

<input type="button"
onclick=
"location =
document.form1.dd1.options
[document.form1.dd1.selectedIndex].value;"
value="GO">

</form>

I have put the code into every page manually but i;m sure there is an easy way of doing it. Could I put it as a seperate file and link it into my pages (like with a css) so that every time I update it on the main file it automatically updates on every page to include the new links>?

Thanks in advance

Robin_reala

10:26 pm on Sep 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, but not with CSS. You'd want to use a server side scripting language to pull in chunks of HTML into your page. For example (in PHP), given a menu.php page containing just the code you've written above, you'd add to each page:

<?php include 'file.txt';?>

Then in future you'll only have to update menu.php for the changes to be copied out to all your pages.