i am pretty new to php and programming…
but when i look at the code below i think there must be an easier way to do this that involves less code.
[code=php]
$ha = ‘<a href=”sub.php?menu=ha&cat=ha_main”>Håndverk</a>’;
$hu = ‘<a href=”sub.php?menu=hu&cat=hu_main”>Husleie</a>’;
$re = ‘<a href=”sub.php?menu=re&cat=re_main”>Reiser</a>’;
$va = ‘<a href=”sub.php?menu=va&cat=va_main”>Varer</a>’;
echo “<ul>”;
if ($cat == ‘ha_main’){
echo “<li>” . $hu . “</li>”;
echo “<li>” . $re . “</li>”;
echo “<li>” . $va . “</li>”;
}
elseif ($cat == ‘hu_main’){
echo “<li>” . $ha . “</li>”;
echo “<li>” . $re . “</li>”;
echo “<li>” . $va . “</li>”;
}
elseif ($cat == ‘re_main’){
echo “<li>” . $ha . “</li>”;
echo “<li>” . $hu . “</li>”;
echo “<li>” . $va . “</li>”;
}
else{
echo “<li>” . $ha . “</li>”;
echo “<li>” . $hu . “</li>”;
echo “<li>” . $re . “</li>”;
}
echo “</ul>”;
does anybody know how i can do this with more intelligent code??
what i am doing is:
if you are on a page with category ha_main then i dont want to show the link for the category that you have already chosen. only the 3 other categories…
see it in action here:
[url]http://www.morganwaage.com/fb/index2.php