PHP and Webpages.

Eric M
2008-04-19 07:17:38
PHP and Webpages.
Hi. It's been tormenting me for a long time now.
But, how can I update my main page's links without having to update every other page of my website? I used the PHP code before but I lost it and can't find it. PLEASE SOMEONE HELP. THANK YOU!!!
Veselin
2008-04-19 09:39:34
Re:
can you please paraphrase your question because it is not clear what you need to do. Are you asking how to update the file names of your web pages without having to change actual pages?
Alin
2008-04-20 18:25:00
Re:
I think he is talking about the links inside the page. Like a navigation menu.

To display the same menu on every page, you can create a menu.php page where your navigation links are located, and then, in the site's pages, where the menu should be, you just include the menu.php page.
<?php include_once('menu.php'); ?>

This way you just modify menu.php, without having to update the other pages.
Veselin
2008-04-20 19:20:03
Re:
good point Alin. Yes using include is a good option but this way you should use it only in PHP pages. In case you want to use PHP code (in your case include a file) in HTML files you should use .htaccess file and put the line below in it to make HTML files read as PHP

AddType application/x-httpd-php .php .htm .html.
Eric M
2008-04-25 22:41:34
Re:
Yes, a navigation menu.
But I remember there having to be an ending code along with <?php include_once('menu.php'); ?>.
Reply
Title:
Your name:
Your email: (email address will not be posted on the web site)
Reply:
Verification