View Full Version : Resolved centrally stored menu
henkroos
11-06-2009, 07:57 AM
Hi there,
I'm looking for a way to centrally store and maintain a website navigation menu. The idea is that I can edit the menu without having to edit all the pages of my website. I use a vertical (css) dropdown menu.
Is this possible? And how do I do this?
Gr. Henk
Does your host support PHP? To find out if they do, make a new file called "test.php" on your website. Inside that file, put the following code:
<?php
phpinfo();
?>
Then link me to the page.
Good luck.
henkroos
11-07-2009, 09:29 AM
Hi Nile,
My host does support php. You can see that on www.qstitch.nl/test.php
Hope you can help me?
Gr. Henk
Ok, make a file called .htaccess, and put this code in it:
AddType application/x-httpd-php .html
Then, make a file called menu.php. Place your menu links in that file(example:)
<a href="Home.html">Home</a>
Then, on ever page, replace your navigation bar with:
<?php
require('menu.php');
?>
That should work, tell me if it doesn't. (You'll be able to change menu.php to what ever you want your menu to be, and it SHOULD effect all teh pages.)
henkroos
11-09-2009, 06:46 AM
Hi Nile,
Thank's for the help. I'm going to try it and let you know how it went.
The first file I have to name .htacces? Do I need to put anything before the dot?
Gr. Henk
henkroos
11-09-2009, 07:08 AM
Hi Nile,
I tried it but it does not seem to work.
What did I do wrong?
http://www.qstitch.nl/tijdelijk/menu.php
http://www.qstitch.nl/tijdelijk/.htaccess
http://www.qstitch.nl/tijdelijk/home.html
http://www.qstitch.nl/tijdelijk/borduren_algemeen.html
http://www.qstitch.nl/tijdelijk/bestellen.html
Gr. Henk
Hmmm, in your .htaccess remove the current code, and add:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
if that doesn't work, try:
AddType php5-cgi htm html
Good luck!
henkroos
11-10-2009, 09:17 AM
Nile,
I've tried them both but no succes. Maybe it is because of the way the menu is built?
Partially css and partially script. A piece of the script is in the external stylesheet and
the rest is in the html document.
Or is it because the menu html is in an <UL>?
http://www.qstitch.nl/tijdelijk/qstitch.css
Gr. Henk
No, it is not the way the menu is built. ;)
Ok, I know for sure this will work:
Change all the files from .html to .php.
Haha, good luck!
henkroos
11-10-2009, 06:59 PM
Nile,
It works like a charm. Thank's a million.
Do you have any preference on wich code I put in the .htaccess file?
Or is there no difference what so ever? I've tried them all and they all
seem to be working fine now?
Gr. Henk
You can delete all the code with in the htaccess. Good luck!
It seems your topic is solved... Please set the status to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.