Using PHP repetitive content to create navigation bar?

cazarupt

New member
I want to create a navigation bar that goes on every page of my website, and I Only have to update one file to get every page to update, I understand I can do this with PHP. I've got as far as learinng these tags;
<?

include("navigation.htm");

?>
but what do I put where "navigation.htm" is? If, for example I want to use this to add a daily quote, then how would I do that, would I have to create a web page with the quote and then use the web address?

Please someone help. Any personal experience or links to tutorials would be greatly appreciated.
Can people please not just post links to general tutorial or web design sites individual tutorials would be much more useful. Thankyou.
 
You can include a html file.. but it will be static. If you want to include dynamic content you will need to include another php file that generates the content dynamically e.g. it could hold an array of quotes e.g. 365 quotes -- one for each day of the year. It would also need to store the date and the index of the current quote to file. Every time it is requested to display the quote it will check if the current date is the same as the one on file. If it is the same it will just output the current quote which is linked to the current index. If the date has changed it will write the new date to file (over-writing the previous one) + increment the quote index by one and write that to file also. It will then output the new quote based on the incremented index.
 
Back
Top