|
Description
This is a way to use links like: http://www.example.com/index.php?whatever=page.
Normally navigation is done though the switch() function, but I decided to do it with arrays,
<php //----------------------------- // Defining the links. //----------------------------- $home = 'news'; 'home' => array($home,
$home), 'news' => array('news',
'news'), 'about' => array('about',
'about'), 'contact' => array('contact', 'contact'), ); //------------------------- // Load the module //------------------------- { foreach($pages as $id => $filearray) { $file = "modules/".$filearray[0].".php"; { { include $file; // The file has been located and it's being included. } else { die(); // The file didn't exist, therefore the
script ends. } } } } //----------------------------------------------- // Show the home page //----------------------------------------------- else { $file = "/modules/" . $home . ".php"; { require $file; // The file has been located and it's being included. } else { die(); // The file didn't exist, therefore the
script ends. } } ?> |
|