We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29771
    • 12 Posts
    The Navigationlinks are not korrektly but i don’t know why. I hope you can help me.

    That’s my navigation.
    //SimpleMenu 0.1
    //Luca Allulli December 2005
    //License: GNU General Public License 2
    
    //Begin param
    $rootid=isset($rootid)? $rootid: 0;
    $pageid=isset($pageid)? $pageid: $modx->documentIdentifier;
    //End param
    
    $output="";
    
    $children=$modx->getDocumentChildren($pageid);
    if(!empty($children)) {
    	foreach($children as $child) {
    		if($child['id']!=$pageid)
    			$item='<li> <a href="[~'.$child['id'].'~]">'.$child['pagetitle']."</a></li>\n";
    		else
    			$item="<li>".$child['pagetitle']."</li>\n";
    		$output.=$item;	
    	}	
    	$output="<ul>\n".$output."</ul>\n";	
    }
    
    $pid=$pageid;
    
    if($pid==rootid)
    	$goon=false;
    else {
    	$goon=true;
    	$ris=($modx->getParent($pid));
    	$oldid=$pid;
    	$pid=$ris['id'];
    }
    
    while($goon) {
    	$children=$modx->getDocumentChildren($pid);
    	$before=true;
    	$out1="";
    	$out2="";
    	foreach($children as $child) {
    		if($child['id']!=$pageid)
    			$item='<li> <a href="[~'.$child['id'].'~]">'.$child['pagetitle']."</a></li>\n";
    		else
    			$item="<li>".$child['pagetitle']."</li>\n";
    		if($before)
    			$out1.=$item;
    		else
    			$out2.=$item;
    		if($child['id']==$oldid)
    			$before=false;
    	}
    	$output="<ul>\n".$out1.$output.$out2."</ul>\n";
    	$oldid=$pid;
    	if($pid==$rootid)
    		$goon=false;
    	else {
    		$ris=($modx->getParent($pid));
    		$pid=$ris['id'];
    	}
    }
    return $output;
    


    You can see the Problem on:
    http://salicru.de

    If you click through the Navigation, you’ll see the problem.

    Greets MiKe