Go Back   Dynamic Drive Forums > General Coding > Other
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-06-2009, 07:57 AM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default centrally stored menu

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

Last edited by henkroos; 11-11-2009 at 08:16 AM.
Reply With Quote
  #2  
Old 11-06-2009, 08:22 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

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 Code:
<?php
phpinfo
();
?>
Then link me to the page.

Good luck.
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
  #3  
Old 11-07-2009, 09:29 AM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Nile,

My host does support php. You can see that on www.qstitch.nl/test.php
Hope you can help me?

Gr. Henk
Reply With Quote
  #4  
Old 11-07-2009, 03:39 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Ok, make a file called .htaccess, and put this code in it:
Code:
AddType application/x-httpd-php .html
Then, make a file called menu.php. Place your menu links in that file(example
Code:
<a href="Home.html">Home</a>
Then, on ever page, replace your navigation bar with:
Code:
<?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.)
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
  #5  
Old 11-09-2009, 06:46 AM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6  
Old 11-09-2009, 07:08 AM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #7  
Old 11-09-2009, 11:46 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Hmmm, in your .htaccess remove the current code, and add:
Code:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
if that doesn't work, try:
Code:
AddType php5-cgi htm html
Good luck!
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
  #8  
Old 11-10-2009, 09:17 AM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #9  
Old 11-10-2009, 12:58 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

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!
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
  #10  
Old 11-10-2009, 06:59 PM
henkroos henkroos is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Last edited by henkroos; 11-10-2009 at 07:30 PM.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:39 PM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.