I have this array file links.php
<?
#nav structure
$navLinks = array(
array('title' => 'Home', 'link' => 'index.php','page_name' => 'home', ),
array('title' => 'News', 'link' => 'news.php','page_name' => 'news', ),
array('title' => 'Biography', 'link' => 'biography.php','page_name' => 'biography', ),
array('title' => 'Discography', 'link' => 'discography.php','page_name' => 'discography', ),
array('title' => 'Wallpapers', 'link' => 'wallpapers.php','page_name' => 'wallpapers', ),
array('title' => 'Media', 'link' => 'media.php','page_name' => 'media', ),
array('title' => 'Lyrics', 'link' => 'lyrics.php','page_name' => 'lyrics', ),
array('title' => 'Fan Book', 'link' => 'fanbook.php','page_name' => 'fanbook', ),
);
?>
I want the following files to be pulled by their 'page_name' so if I put http://www.domain.com/?page=lyrics the 'lyrics.php' page will display.
Here is the main page index.php
<?
include 'links.php';
for ($i=0; $i<count($navLinks); $i++) {
$pages = $navLinks[$i];
// using a switch
switch ($_GET['page']) {
case '$pages[page_name]':
include ('$pages[link]');
break;
}
}
?>
It's not working at all, anyone tell me what I'm doing wrong?
Thanks for your time.