For some reason my ul and lis are not matching up correctly according to my code. Not quite sure why. I’ve tried moving it in and out of the loops and nothing seems to be correct.
http://kansasoutlawwrestling.com/site-map
<?php
if((isset($categoriesArray)) AND ((!empty($categoriesArray))||($categoriesArray !== NULL)))
{
if(count($categoriesArray) <= 0)
{
echo "There are no content pages on this site!";
}
else
{
if (count($categoriesArray) > 0)
{
foreach ($categoriesArray as $row)
{
echo "<h2>".stripslashes($row['name'])."</h2>";
echo "<ul>";
if (count($row['children']) > 0)
{
foreach ($row['children'] as $row2)
{
echo "<li><a href=\"".$row2['link_url']."\">".stripslashes($row2['link_name'])."</a></li>";
if (isset($row2['child_pages']) > 0)
{
echo "<ul>";
foreach ($row2['child_pages'] as $row3)
{
echo "<li><a href=\"".$row3['link_url']."\">".stripslashes($row3['link_name'])."</a></li>";
}
echo "<ul>";
}
}
}
echo "</ul>";
}
}
}
}
else
{
echo "There are no content pages on this site!";
}
?>
1) You have a typo:
That last echo should be “</ul>”.
2) Even with that typo fixed, you have <ul><li></li><ul><li></li></ul></ul> nestings. The inner <ul> elements should be nested within an extra <li> element, which you can do by adding li opening and closing tags to the first and third echo in the lines I copied.