Depending on how many subcategories the user is, I want to display links showing the higher subcategories. Here is an example of where a user could be:
Counter-Strike (category)
--------|
--------|----Weapons (subcat1)
-----------------|
-----------------|------USP (subcat2)
(I have all the subcategories recorded in a database.) The user shown above would have a url like this:
models.php?category=Counter-Strike&subcat1=Weapons&subcat2=USP. I want to show the following:
Counter-Strike >> Weapons >> USP
The problem is finding IF statements that will show the correct listing. Because if the user is in the Counter-Strike folder but not in any subcategories then subcat1 and subcat2 should not be shown. This should be shown:
Counter-Strike
Here is what I have so far, the problem is that 2 of the IF statements return true if subcat1 and subcat2 are both NULL.
Code: Select all
<?php
if ($subcat1=="" && $subcat2==""){echo $category;}
if ($subcat1==""){echo "<a href='models.php?category=$category'>$category</a> >> $subcat1";}
else {echo "<a href='models.php?category=$category'>$category</a> >> <a href='models.php?category=$category&subcat1=$subcat1'>$subcat1</a> >> $subcat2";}
?>http://members.lycos.co.uk/duff234/mode ... ter-Strike (this one doesnt work)
http://members.lycos.co.uk/duff234/mode ... t1=Weapons
http://members.lycos.co.uk/duff234/mode ... ubcat2=USP
Thanks for any help.