1
0

Update tabs.php

This commit is contained in:
Aaron Lindsay 2014-01-24 22:08:37 -05:00
parent c4fa5efcee
commit 98e62cf748

View File

@ -3,24 +3,21 @@
<ul> <ul>
<?php <?php
$tabs = array( $tabs = array(
"Home" => "/", "Home" => array("aclindsay.com", "", "%^/?$%"),
"Blog" => "/blog/", "Blog" => array("blog.aclindsay.com", "", "%.*%"),
"Contact" => "/contact/", "Contact" => array("aclindsay.com", "/contact", "%^/contact(/.*)?%"),
"Projects" => "/projects/", "Projects" => array("aclindsay.com", "/projects", "%^/projects(/.*)?%"),
"Resume" => "/resume/" "Resume" => array("aclindsay.com", "/resume", "%^/resume(/.*)?%")
); );
$base_domain = $_SERVER['HTTP_HOST'] == "aclindsay.com"; $http_host = $_SERVER['HTTP_HOST'];
$request_uri = $_SERVER['REQUEST_URI'];
foreach ($tabs as $name => $url) { foreach ($tabs as $name => $tab_info) {
if ($url == "/") { if ($tab_info[0] == $http_host && preg_match($tab_info[2], $request_uri))
if ($base_domain && $_SERVER['REQUEST_URI'] == "/") $class="current";
echo "\t\t<li><a href=\"".$base_url."/\" class=\"current\">Home</a></li>\n";
else
echo "\t\t<li><a href=\"".$base_url."/\">Home</a></li>\n";
} else if (strncmp($url, $_SERVER['REQUEST_URI'], strlen($url)) == 0)
echo "\t\t<li><a href=\"".$base_url."".$url."\" class=\"current\">".$name."</a></li>\n";
else else
echo "\t\t<li><a href=\"".$base_url."".$url."\">".$name."</a></li>\n"; $class="inactive";
echo "\t\t<li><a href=\"".$protocol.$tab_info[0].$tab_info[1]."\" class=\"".$class."\">".$name."</a></li>\n";
} }
?> ?>
</ul> </ul>