I have a stylesheet, which on the navbar places an arrow under the current page.
All it requires is the current page link has the <li class="current_page_item">Current Page</li> style set. All the other pages just have the <li>Other Page</li> attribute.
With my very limited knowledge of php, I wrote the script below which gets the current page name, and then determines where to place the arrow.
<?php
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
$page = $parts[count($parts) - 1];
if ($page == 'index.php') {
echo '<li class="current_page_item">';
} else {
echo '<li>';
}
echo '<a href="index.php">Home</a></li>';
if ($page == 'gallery.php') {
echo '<li class="current_page_item">';
} else {
echo '<li>';
}
echo '<a href="gallery.php">Gallery</a></li>';
if ($page == 'info.php') {
echo '<li class="current_page_item">';
} else {
echo '<li>';
}
echo '<a href="info.php">Info</a></li>';
if ($page == 'design.php') {
echo '<li class="current_page_item">';
} else {
echo '<li>';
}
echo '<a href="design.php">Design</a></li>';
if ($page == 'updates.php') {
echo '<li class="current_page_item">';
} else {
echo '<li>';
}
echo '<a href="updates.php">Blog/Updates</a></li>';
?>
It seems awfully long for what I'm trying to achieve, so I wondered if anyone else has ideas about a shorter script I could use?
I hope this makes sense.