The code below works fine, it returns a list of navagation links and gives them unique colors, but why does adding
'<div title="Home" id="logo" onclick="window.location = \''.SITE_ROOT.'\';"></div>'
give me header output errors?
Removing it makes it work fine.
Even <div></div>
would give me an error. I know it's because I'm outputting early, but if I remove this <div>
there is still a div before it and it doesn't cause any problem.
Hmm, well here is my code:
<?php
function printNavagation($this){
$i = 0; $n = 0; $x = count($this);
echo '<div class="navagation"><div title="Home" id="logo" onclick="window.location = \''.SITE_ROOT.'\';"></div><ol><li class="libreak">|</li>';
while ($i < $x){
$link[$i] = $this[$i]; // Link is same as name
// Except theese:
if ($link[$i] == 'home'){$link[$i] = '';} else if ($link[$i] == 'djs'){$this[$i] = 'DJs'; $link[$i] = 'djs/home';}
// set onhover colors
if('1' == $n){$color = 'pink';} else if('2' == $n){$color = 'green';} else if('3' == $n){$color = 'yellow';} else {$color = 'blue';}
echo '<li class="'.$color.'"><a href="'.SITE_ROOT.'/'.$link[$i].'">'.ucfirst($this[$i]).'</a></li><li class="libreak">|</li>'; //wrap results
$i++; $n++; if($n >= 4){$n = 0;} // reset alternating color counter
}
echo'</ol></div>';
}
?>