Forum Moderators: coopster
<div>
<ul>
<li> <a href="index.php?page=test01"/>Test 01</a></li>
<li> <a href="index.php?page=test02"/>Test 02</a></li>
<li> <a href="index.php?page=test03"/>Test 03</a></li>
</ul>
</div>
<div>
<?php
if(isset($_GET['page']) && file_exists($_GET['page'].".php")) {
include ($_GET['page'].".php");
}
elseif(empty($_GET['page'])) {
echo "No Pages Selected";
}
?>
</div> NAVIGATION CONTROL DOCUMENT:<?php
$ident = 'home';
echo 'Hello there!';
?>
And the above would set the <a class="active" for the current page, and <a class="link" for all the others.<?php
$links = array(
array('Home Page', '/', 'home'),
array('News', '/news', 'news'),
array('Site info', '/info', 'info')
);
$count = count($links);
for($i = 0; $i < $count; $i++) {
$highlight = (isset($ident) && $ident === $links[$i][2])? 'active' : 'link';
echo '<br><a class="' . $highlight . '" href="' . $links[$i][1] . '">' . $links[$i][0] . '</a>';
}
?>
<div>
<?php
if(isset($_GET['page']) && file_exists($_GET['page'].".php")) {
include ($_GET['page'].".php");
}
elseif(empty($_GET['page'])) {
$ident = 'home';
echo "No Pages Selected";
}
?>
</div>
<div>
<?php
$links = array(
array('Home Page', 'index.php','home'),
array('Test 01', 'index.php?page=test01', 'test01'),
array('Test 02', 'index.php?page=test02', 'test02')
);
$count = count($links);
for($i = 0; $i < $count; $i++) {
$highlight = (isset($ident) && $ident === $links[$i][2])? 'active' : 'link';
echo '<br><a class="' . $highlight . '" href="' . $links[$i][1] . '">' . $links[$i][0] . '</a>';
}
?>
</div>
<div>
<?php
$links = array(
array('Home Page', 'index.php','home'),
array('Test 01', 'index.php?page=test01', 'test01'),
array('Test 02', 'index.php?page=test02', 'test02')
);
$count = count($links);
for($i = 0; $i < $count; $i++) {
$highlight = (isset($ident) && $ident === $links[$i][2])? 'active' : 'link';
echo '<br><a class="' . $highlight . '" href="' . $links[$i][1] . '">' . $links[$i][0] . '</a>';
}
?>
</div>
<div>
<?php
if(isset($_GET['page']) && file_exists($_GET['page'].".php")) {
include ($_GET['page'].".php");
}
elseif(empty($_GET['page'])) {
$ident = 'home';
echo "No Pages Selected";
}
?>
</div>
And then, where the content would go, you have
<?php
$ident = 'home';
$content = 'Hello! Welcome to my site!';
?>
echo (isset($content) && !empty($content))? $content : 'Error';