Thanks folks for the quick reply!
I will illustrate a bit further what I am trying to do so that you may direct me in approaching this problem in the right way.
PHP Code:
<?php
function output_categories($categories){
foreach($categories as $cat){
output_category($cat);
}
}
function output_category($cat){ global $counter; $counter++;?>
<li class='level-<?php echo $cat->level +1 ?>'>
<?php if(isset($cat['subcats'])): ?>
<div class='expandable'>+</div>
<?php endif; ?>
<p><?php echo $cat['name'] ?><span> (<?php //echo $categories->countPics($cat['id']) ?>)</span></p>
<?php if(isset($cat['subcats'])): ?>
<ul>
<?php output_categories($cat['subcats']) ?>
</ul>
<?php endif; ?>
</li>
<?php } ?>
<ul>
<?php output_categories($categories->cats);?>
</ul>
The reason why I wanted to format it this way is to maintain HTML readability.
I could return HTML as a string but that is gonna hinder the HTML readability. So the function output_category(); will act as a template that may contain quite a lot of html. How could I go about this in a more clever or organized way?
Thanks again for your input.
Andres.
Bookmarks