Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Доступ к глобальным массивам  (Read 4929 times)

0 Members and 1 Guest are viewing this topic.

vandru

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Доступ к глобальным массивам
« on: January 20, 2012, 08:11:57 am »

Добрый день! Пытаюсь сделать своё меню таким образом:
В файле themes.php написал функцию my_head2() которая создает необходимое мне меню. Необходимо текущему пункту меню присваивать class="active".
Пробывал сделать это так
Code: [Select]
( $_GET['album']=='lastup'  ?'class="active"':'') - не работает.
Code: [Select]
var_dump($_GET) выдает null.
Можно ли решить эту задачу по другому без использования глобальных массивов?

Code: [Select]
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;
}
Logged

vandru

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

Разобрался сам. Нашел объект $superCage, со свойствами get, post, cookie, env, server.
Code: [Select]
global $superCage;
$get=$superCage->get->_source;
Теперь $get - содержит запросы GET
$_GET['album'] = $get['album']
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.