Hi red wolf,
A lot depends on how your data is structured, but take a look at this example:[php]$menu = array(‘Cars’=>array(‘Mercedes Benz’,‘Lexus’,‘Porsche’),‘Watches’=>array(‘Rolex’,‘Ball’),‘Toasters’=>array());
echo ‘
if(count($subcats) > 0)
{
echo '<ul><li>';
echo implode('</li><li>',$subcats);
echo '</li></ul>';
}
}
echo ‘’;[/php]
This will produce the following html:[code]
- Cars
- Mercedes Benz
- Lexus
- Porsche
- Watches
- Toasters
[/code](I inserted line breaks above to make it easier to view)
This assumes you have an array of categories, some of which have an array of subcategories. It first generates the main category list item and then checks to see if there are subcategories and outputs them if they exist. Obviously, you would need to adjust this to fit your actual data structure.
You could easily accomplish the same thing by substituting a foreach or other similar loop, and might need to add a reiterating loop if your subcategories have subcategories, etc.
Let me know if you have any trouble implementing something like this with your actual data.