Where Clause in Category List

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 9, 2012   (RSS)

Re: [InHouse] Where Clause in Category List

There isn't a way you can use a where clause in the getCategories function. But you can get around this problem by differentiating between the two in the foreach loop instead. So you could use something like this:

<ul class="style6">
<?php foreach ($records as $record): ?>
<?php if($record['show_in_main_nav'] == '1'): ?>
<?php echo $record['_listItemStart'] ?>
<?php if ($record['_isSelected']): ?>
<strong>
<?php if (!$record['_hasChild']):?>
<a href="<?php echo $record['_link'] ?>">
<?php endif; ?>
<?php echo $record['name'] ?>
<?php if (!$record['_hasChild']):?>
</a>
<?php endif; ?>
</strong>
<?php else: ?>
<?php if (!$record['_hasChild']):?>
<a href="<?php echo $record['_link'] ?>">
<?php endif; ?>
<?php echo $record['name'] ?>
<?php if (!$record['_hasChild']):?>
</a>
<?php endif; ?>
<?php endif ?>
<?php echo $record['_listItemEnd'] ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>


Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Where Clause in Category List

By InHouse - November 9, 2012

Thanks Greg. That is the way I wound up doing it. Glad I wan't just missing something obvious (for a change).

Cheers,
J.