Excluding specific record

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

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: [Hansaardappel] Excluding specific record

By Kenny - April 18, 2010

You could use the "hidden" feature by creating a checkbox in the backend and making the table name "hidden" and the field name "Hidden".

This checkbox field indicates that the record should be not be displayed on the website. This lets users temporarily make records visible or not.

That's the simple version.

Let us know if that works for you.

Kenny

Re: [sagentic] Excluding specific record

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/