Forum Moderators: coopster
What I have is a page that lays out what includes are required:
Header
Contect
Footer
Now i want to be able to link to the page include construct and automatically include the correct content file based on the link that is clicked.
IE: if you click on the about me link the content incluce will change to the aboutme include from the default home include you start off with when reaching the site.
I was told this is possible without a data base, but i dont know how to do that or with a data base either.
I know how to make includes and have them be pulled in from a normal href link, but that doesnt make it dynamic like i want it.
Can anyone help me with this and/or point me in the right direction i need to go to learn how to do this?
For server information:
php 4&5
mysql with phpmyadmin
apache
linux red hat
and all the typical normals of a web server.
Any help and discussion greatly appreciated.
Try something like this:
test.php
<?php
include("header.html");
$page = $_GET['page'].'.html';
if(file_exists($page)) { //assuming the files exist in the same directory
include($page);
}
include("footer.html");
?>
Now for the links, you would just make them something like this:
<a href='test.php?page=home'>Home</a>
This link includes home.html into the content area.
I hope this has helped.
Best of luck!
*Note: There can be security issues if you are not careful including pages in this way.*