Hello,
I've been using a rather simple tab menu/website structure. Each tab link referred to an include located within a switch statement. Thus, all page changes took place within the index file. Here is a condensed version of my Index file.
<?php $highr = ($_GET['page']); ?>
<ul id="nav">
<?php
// This is the script for the menu
// Menu items
$mainMenu['Home'] = 'index.php?page=home';
$mainMenu['Music'] = 'index.php?page=music';
$mainMenu['About'] = 'index.php?page=about';
//This part creates the above menu items as tabs
foreach ($mainMenu as $menu => $link) {
echo '<li><a href="'.$link.'"';
//Identifies the active page, if active the tab is given the class="active"
$wadr = $link;
$parts = explode("=",$wadr);
$wadr = $parts['1'];
if ($highr == $wadr){
echo ' class="active"';
}
echo '>'.$menu.'</a></li>';
}
?>
</ul>
<table><tr><td>
<?php
//This is where the pages appear
switch ($_GET['page'])
{
case "home":
include('home.php');
break;
case "music":
include('music.php');
break;
case "about":
include('about.php');
break;
default:
include('start.php');
break;
}
?>
</td><td>
<?php
// This content will not change
include('sidebar.php');
?>
</td></tr></table>
What I like about this, and want to keep, is the possibility to link directly to a tab through the address bar, for example, writing http://www.domain.com/index.php?page=home would get me to the home tab of my website.
However, the current limit is that every time I click a tab, the entire website reloads. Instead, and what I need assistance with, is a method so only the switch method changes rather than the entire website reloads. Any suggestions?
I'm assuming the end-result will approach something like the tab system on the following page:
http://www.theoldecookerybook.com/~theopden/wiki/index.php/Colonel_Plomer%27s_Shrewsbury_Cake#tab=Original_text
But I'm unsure how to go about this.
Thank you beforehand for any assistance!