Filter Out certain record from list
2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 14, 2011 (RSS)
By (Deleted User) - January 13, 2011
Hello,
I know this is probably going to be really easy. I have a list using:
In the header and:
To display a drop down list of the guided_tourRecords.
How can i eliminate one tour from this list? Lets say record number 37?
Thanks Jono
I know this is probably going to be really easy. I have a list using:
list($guided_tourRecords, $guided_tourMetaData) = getRecords(array(
'tableName' => 'guided_tour',
'orderBy' => 'tour_start_date ASC',));?>
In the header and:
<label>
<select name="fields_guidedtour">
<option>Not Selected</option>
<?php foreach ($guided_tourRecords as $record): ?>
<option><?php echo $record['title'] ?> - <?php echo date("M jS, Y", strtotime($record['tour_start_date'])) ?> to <?php echo date("M jS, Y", strtotime($record['tour_end_date'])) ?></option>
<?php if (!$record['ftour_avail']): ?><?php else: ?>
<option><?php echo $record['title'] ?> - <?php echo date("M jS, Y", strtotime($record['ftour_start_date'])) ?> to <?php echo date("M jS, Y", strtotime($record['ftour_end_date'])) ?></option>
<?php endif ?><?php endforeach; ?>
</select>
</label>
To display a drop down list of the guided_tourRecords.
How can i eliminate one tour from this list? Lets say record number 37?
Thanks Jono
Re: [jonoc73] Filter Out certain record from list
By Jason - January 14, 2011
Hi Jono,
If you know at run time the record number of a record you don't want to have in your list, you can do this:
If you want this to apply to multiple record, and which records are being excluded change from time to time, then this isn't a very robust solution. Another thing you could do is add a check box to your section called "exclude" If it's checked, you don't output the record like this:
Hope this helps.
If you know at run time the record number of a record you don't want to have in your list, you can do this:
<?php foreach ($guided_tourRecords as $record): ?>
<?php if($record['num']==37){ continue; } ?>
If you want this to apply to multiple record, and which records are being excluded change from time to time, then this isn't a very robust solution. Another thing you could do is add a check box to your section called "exclude" If it's checked, you don't output the record like this:
<?php foreach ($guided_tourRecords as $record): ?>
<?php if($record['exclude']){ continue;} ?>
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/