Excluding specific record

5 posts by 3 authors in: Forums > CMS Builder
Last Post: April 19, 2010   (RSS)

By Hansaardappel - April 16, 2010

Is it possible to exclude a specific record? Say I've got a category that contains item 1 till item 10 and I want to display every item, except for number two. What code should I use to achieve this?

Thanks!

Re: [sagentic] Excluding specific record

By Hansaardappel - April 18, 2010

Thanks for the reaction, but that's not really want I meant. My idea is to exclude "item 2" on a certain page, and show it on another page, where I exclude another record.

Re: [Hansaardappel] Excluding specific record

By Jason - April 19, 2010

Hi,

If you know the record number of the record you want to exclude on that particular page, you could try this:

<?php $exclude= *NUMBER*; ?.

...

<?php foreach ($records as $record) : ?>
<?php if($record['num']!=$exclude): ?>
*DISPLAY CODE *
<?php endif ?>
<?php endforeach ?>


Replacing *NUMBER* with the record number you wanted to exclude. You can modify this if you like to match a title, or any other field, so long as you know the EXACT value of the record you don't want to display.

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/

Re: [Jason] Excluding specific record

By Hansaardappel - April 19, 2010

Thanks Jason, once more exactly what I had in mind. Thanks so much!