Jump to content

Subnav (second navigation) problem


Qtix

Recommended Posts

Hi

I've got an website  ;) made in php  :o i make my pages with an Content Management System. But in the second navigation bar i need serveral links to different pages, so i made a code that whenever its that Title go to that page if not then show the content made by the management system. but i get to see double links, one from my PHP code and the other to the page created by my management system. When i delete the "else" code everything is fine only now i cant see my links to the pages made by my content management system. Everything i tried resulted in an error. and i know that using "if" several times isnt the right way but i cant think of something else.


/**
* set secondary navigation
*/
if (!isset($aVars['g']['c']) ||
!is_numeric($aVars['g']['c']))
$sSecondNav = null;
else {
$aCategory = array(
'von',
$aVars['g']['c']
);

$aOrderedSecondNav = processItems($aCategory);

//proccess current order
$sSecondNav = null;

if (!empty($aOrderedSecondNav)) {
for ($i = 0; $i <= max(array_keys($aOrderedSecondNav)); $i++) {
if (!isset($aOrderedSecondNav[$i]))
continue;
else
$aItems = $aOrderedSecondNav[$i];

$j = 0;
foreach ($aItems as $oItem) {
//obtain the first content
if (!isset($aVars['g']['id']) && $j ==0)
$aVars['g']['id'] = $oItem->getID();

if (strtolower($oItem->getTitle()) == 'schaarheftafels')
$sSecondNav .= '<ul><a class="sb" href="schaarheftafels.php?c=135&id=120">'.$oItem->getTitle().'</a>';  

if (strtolower($oItem->getTitle()) == 'autoliften')
$sSecondNav .= '<ul><a class="sb" href="autoliften.php">'.$oItem->getTitle().'</a>';

if (strtolower($oItem->getTitle()) == 'platformliften')
$sSecondNav .= '<ul><a class="sb" href="platformliften.php">'.$oItem->getTitle().'</a>';

if (strtolower($oItem->getTitle()) == 'goederenliften')
$sSecondNav .= '<ul><a class="sb" href="goederenliften.php">'.$oItem->getTitle().'</a>';
if (strtolower($oItem->getTitle()) == 'mindervaliden')
$sSecondNav .= '<ul><a class="sb" href="mindervaliden.php">'.$oItem->getTitle().'</a>';
if (strtolower($oItem->getTitle()) == 'afvalcontainers')
$sSecondNav .= '<ul><a class="sb" href="afvalcontainers.php">'.$oItem->getTitle().'</a>';
if (strtolower($oItem->getTitle()) == 'stapelaars')
$sSecondNav .= '<ul><a class="sb" href="stapelaars.php">'.$oItem->getTitle().'</a>';
else
$sSecondNav .= '<ul><a class="sb" href="'.$_SERVER['PHP_SELF'].'?c='.(int)$aVars['g']['c'].'&amp;id='.(int)$oItem->getID().'">'.$oItem->getTitle().'</a></ul>';
$j++;
}
}
}
}

Link to comment
https://forums.phpfreaks.com/topic/29903-subnav-second-navigation-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.