Dynamic html Q
- Started
- Last post
- 12 Responses
- NegativeSpace
I have a javascript menu that I want on every page of a site, I am trying to clean up some other web designers website and he had put the code on EVERY single page, so updating is a bitch. What would the best way to make the whole menu dynamic so I just have to update one file.
PHP includes? or is there a different more effective way?
- Engage_London0
php includes are nice and simple... not sure of any other better ways... depends how expandable you make it
- canuck0
There is a catalog site I have been working on, at first it wasn't that big, but then it expanded and now I am kicking myself for not making the menu more managable.
I should have done a php include for the menu.
- Jaline0
Have an iframe/frame with the menu (with links directing to another frame with content), so that you just have to update that one page.
- foreign0
yeah, php includes is pretty effective, and really simple.
- canuck0
I would do a php include, over the frame route.
- brokenimage0
can you just make a link to a js file? what all do you have to change with the menu, because if it's just the js, you can do this:
then you would only have to change it in that js file.
- stewart0
brokenimage, your code is broken too
- NegativeSpace0
Thanks,
I am not that knowledgable on javascript, and it appears as if it already links to a .js file, but there is still java script within the head tag required for the menu to work, not sure if there is a way for those things to be combined into one file.
It is always a bitch when you gotta fix and correct other peoples work. It sounds like php includes is the most effective way.
- cosmo0
php includes would do the trick in this case.
- NegativeSpace0
Btw, includes work for code in the head tag too right?
- cosmo0
yup.
- UndoUndo0
do a javascript include [which is probably already their by the sounds of it] rip out the code from the head and place into the included file then use dreamweavers find and Replace to delete all the js on the remainding pages.