Simple Sub-Category Markup

11 posts by 2 authors in: Forums > CMS Builder
Last Post: July 5, 2010   (RSS)

By theclicklab - July 5, 2010

Awesome... that worked a treat thanks so much!

In case this is useful to anyone else, the final code I used was:



<li><a href="/destinations.php">Charter Destinations</a>
<ul class="top">
<?php $inactiveChild=0; ?>
<?php $childCount=0; ?>
<?php foreach ($destinationsRecords as $record): ?>
<?php if($record['active']==1 && $record['hide']==0): ?>
<?php if($inactiveChild && !$record['_hasParent']): ?>
</ul></li>
<?php endif ?>
<?php if($record['_hasParent']): ?>
<?php $childCount++; ?>
<?php else:?>
<?php $childCount=0;?>
<?php endif ?>
<?php $inactiveChild=0; ?>
<?php echo $record['_listItemStart']; ?>
<a href="/<?php echo $record['_link'];?>"><?php echo $record['name'];?></a>
<?php echo $record['_listItemEnd'];?>
<?php else: ?>
<?php if($record['_hasParent'] && $childCount==0): ?>
<ul>
<?php $childCount++; ?>
<?php endif ?>

<?php if($record['_hasParent']): ?>
<?php $inactiveChild=1;?>
<?php else: ?>
<?php $inactiveChild =0; ?>
<?php endif ?>
<?php endif ?>
<?php endforeach ?>
</ul>
</li>