: How to keep menu in a single place without using frames This is probably a duplicate, but I can't find the answer anywhere (maybe I'm searching for the wrong thing?) and so I'm going to go
This is probably a duplicate, but I can't find the answer anywhere (maybe I'm searching for the wrong thing?) and so I'm going to go ahead and ask.
What is the accepted standard practice for creating a menu that is stored in a single file, but is included on every page across a site? Back in the day, one used frames, but this seems to be taboo now. I can get things layed out just the way I want, but copy/pasting across every page is a pain.
I have seen php-based solutions, but my cheap-o free hosting doesn't support php (which is admittedly a pain, but it's a fairly simple webpage...).
Any ideas for doing this that does not require server-side scripting?
More posts by @Margaret670
5 Comments
Sorted by latest first Latest Oldest Best
You could create a separate page then use an ajax JavaScript request to retrieve and fill out the menu. This really should probably be on stack overflow.
I hate to even mention this, but it would probably work... you COULD do it in javascript as a bunch of document.write statements and then the script could be mainatained separately from where it's called.
I'd move to a host with PHP though before i messed with that. I'm with hostmonster.com. They offer multiple domains, PHP, MySQL a lot of add ons and it's like /month.
Good luck.
Tough question, but we still have some workarounds to try on:
Server-side includes (SSI)
If you server allows that, you can use @SubTypical solution
XML + XSLT
Yes, none so far told about this one. Will not extend the conversation:
www.google.com/search?q=including+files+with+xml+and+xslt
It can be a little pain, but worth while.
You could run a script to complete your pages prior to uploading to the server. After all, what stops you from running PHP locally and then uploading the results?
If your web hosting supports server side include files, you could store the menu in a separate html file with just the code (no html, header, body, etc. tags). On the page(s) you want to reference the menu, to call the code you'd use an SSI, a reference that would look something like this: <!--#include virtual="http://www.yoursite.com/includes/menu.html" -->.
Hope that helps.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.