Добрый день! Пытаюсь сделать своё меню таким образом:
В файле themes.php написал функцию my_head2() которая создает необходимое мне меню. Необходимо текущему пункту меню присваивать class="active".
Пробывал сделать это так ( $_GET['album']=='lastup' ?'class="active"':'')
- не работает.
var_dump($_GET)
выдает null.
Можно ли решить эту задачу по другому без использования глобальных массивов?
function my_head2(){
global $CONFIG;
$cat_l2 = isset($cat) ? "&cat=$cat" : '';
$lastupd="thumbnails.php?album=lastup$cat_l2";
$lastcom="thumbnails.php?album=lastcom$cat_l2";
$mostviewed="thumbnails.php?album=topn$cat_l2";
$toprated="thumbnails.php?album=toprated$cat_l2";
$html = '<div class="header">
<div class="clearfix">
<h1 class="logo" onclick="location.href=\'/\'"><strong>Mirror of the world.</strong> One photo reflects the one day of your life.</h1>
<form action="thumbnails.php" method="get" class="main-search">
<input type="text" name="search" id="" value="Enter keywords to search for photos..."/>
<input type="hidden" name="album" value="search">
<input type="hidden" name="title" value="on">
<input type="hidden" name="caption" value="on">
<input type="hidden" name="keywords" value="on">
<input type="hidden" name="type" value="OR">
<input type="hidden" name="filename" value="on">
<input type="submit" value="Find photo" class="bt-input big-green" />
</form>
</div>
<div class="top-banner">
<img src="/themes/'.$CONFIG['theme'].'/images/bg-top_banner_planet.jpg" alt="" />
<div class="top-banner-text">
<em>What is our world:</em> How you can see the countries of our World?<br />
<small>Help us to make a picture of the World with your own eyes,</small> <a href="/upload.php"><span>upload a photo</span></a>
</div>
</div>
<div class="nav-bg"><div>
<ul class="nav">
<li '.(strstr($_SERVER['REQUEST_URI'], 'index.php?cat=0') ?'class="active"':'').' ><a href="/index.php?cat=0"><span>View all photos</span></a></li>
<li '.( $_GET['album']=='lastup' ?'class="active"':'').'><a href="'.$lastupd.'"><span>Last upload</span></a></li>
<li '.( $_GET['album']=='lastcom' ?'class="active"':'').'><a href="'.$lastcom.'"><span>Last comments</span></a></li>
<li '.( $_GET['album']=='lastcom' ?'class="active"':'').'><a href="'.$mostviewed.'"><span>Most viewed</span></a></li>
<li '.( $_GET['album']=='toprated' ?'class="active"':'').'><a href="'.$toprated.'"><span>Top rated</span></a></li>
</ul>
</div></div>
</div><!-- header -->';
var_dump($_GET);
return $html;
}
Разобрался сам. Нашел объект $superCage, со свойствами get, post, cookie, env, server.
global $superCage;
$get=$superCage->get->_source;
Теперь $get - содержит запросы GET
$_GET['album'] = $get['album']