Forums

PHP

This topic is locked

Dynamic menu

Posted 02 Dec 2006 23:57:31
1
has voted
02 Dec 2006 23:57:31 bill triplett posted:
I'd like a navigation menu that is located in an external file so I can make one change and have the results show on all pages of a website.

Would I do this with php and mysql or?

Suggestions?

Edited by - rdub on 02 Dec 2006 23:58:43

Replies

Replied 04 Dec 2006 20:57:42
04 Dec 2006 20:57:42 Alan C replied:
You could put the menu structure into a header that was presented using php, then use an include statement to put it at the head of each page.

I would put all the header and footer into a dreamweaver template and apply that to the pages, then when the template was updated dw would do all the work of updating the pages that used that template.

Personal preference must come into the choice too.
Replied 23 Dec 2006 11:19:09
23 Dec 2006 11:19:09 E Brown replied:
I used to do the Dreamweaver template way as well but recently stopped.
Everytime you make one small update, you have to re-upload all of your pages.

The method that seems to work best for me is using php includes. You simply design the menu on one page and link that menu to all pages. When an update is needed edit that one file and upload it to your server.

call the page by typing
<?php include "/internal/file/path/menu.php"; ?>

Make sure all pages that call this page end in php or change your .htaccess file to allow html to accept php commands.

Edited by - ellanab on 23 Dec 2006 11:20:37

Reply to this topic