I'd like to have one file, containing the text and the links for my website.
I'd like to have a php file called menu.php, which features an array, with the link text, and the link href to all the pages on my site.
I'd need it pretty easy to edit, just add a new item to the array or something.
Then on my main page, I simply include that menu.php file, with the links already built.
However, in that menu.php file, I will need to do an if statement, to get the value of the current file.
For example if the script is front.php then format each link/item in the array like this...
Code: Select all
<tr align="left" valign="middle"><td>
<a href="$linkhref">$linktext</a></td><td><img src="bullet.gif" alt="" border="0" /></td></tr>Code: Select all
<a href="$linkhref">$linktext</a><br />
<br />Then from my main page, I simply include menu.php - and hopefully bingo! A site that's really easy to update!
I can do that if statement no problem, but I'm unsure how to actually setup the array, and then get the values out of it and into variables.
In the documentation I found some interesting stuff, functions like foreach and some other things that sound like they would be useful for this.
Unfortunately my PHP knowledge is too limited to be able to use this information.
If someone does know what the heck I'm on about, please explain your code as I'd like to actually understand how it works - and learn some of the syntax structures, rather than just getting it working and forgetting about it.
PHP seems like a complete solution for server-side programming to me. And I think it's essential that I learn it - so an help on this would be greatly appreciated.
Thanks in advance