not display specific (parent) record in category menu

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 7, 2011   (RSS)

By buttermilk - May 6, 2011

Hello all,

I've got a categoy menu set up that seems to be doing what it should: that is, it is displaying all links to the entries in that section editor.

Here's the php:

<ul>
<?php foreach ($servicesRecords as $record): ?>

<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['name'] ?></a></li>

<?php endforeach; ?>
</ul>

What I'd *really* like to do is omit the parent entry so only that link is omitted from the list. Even specifiying the specific entry to not display would be fine by me (it's record number 7).

Any help would be much appreciated.

Re: [buttermilk] not display specific (parent) record in category menu

By Jason - May 6, 2011

Hi,

If you just want to skip over parent records, you can check the depth field. If the depth field is set to 0, this means the record is a top level category.

You can skip over these records like this:

<ul>
<?php foreach ($servicesRecords as $record): ?>

<?php if ($record['depth'] == 0) { continue; } ?>

<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['name'] ?></a></li>

<?php endforeach; ?>
</ul>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/