How to Ignore a search term?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 25, 2017   (RSS)

By dlsweb - July 25, 2017

I have a table named festivals consisting of festival listings in several states.
Within that table I have some as "featured".

My list page lists all..
On one side I have my Featured listings that shows a photo and title. (only features have a "top_photo")

<?php foreach ($festivalsRecords as $record): ?>
<?php if ($record['top_photo']) : ?>
<?php foreach ($record['top_photo'] as $index => $upload): ?>
<p><a href="<?php echo $record['_link'] ?>">
<img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<br />
<?php echo htmlencode($record['title']) ?>
</p>
<?php endforeach ?>
<?php endif; ?>
<?php endforeach ?>

What I want to achieve is when I go to listings for a speciific state,
http://festivalsandevents.com/festivals.php?state=GA
I want to have ALL Features to show on the side- NOT only GA features.

I would also like to order these by RAND (but not the page)

Is that doable?
Thanks much, Larry

By Deborah - July 25, 2017

Hi, Larry.

Here's what I usually do, assuming the 'featured' listings are chosen via a checkbox in the 'festivals' editor. I would create a separate load records name for display of the left-column listings, while leaving the existing code in place for the regular listings.

// load records for featured festivals
list($festivalsRecordsFEATURED, $festivalsMetaData) = getRecords(array(
'tableName' => 'festivals',
'where' => ' featured LIKE "1" ', // if checkbox for featured is checked
'limit' => '5', // change to desired number or remove to show all featured
'orderBy' => 'RAND()', // randomizes display order
'loadUploads' => true,
'allowSearch' => false,
));

<?php foreach ($festivalsRecordsFEATURED as $record): ?>
<?php if ($record['top_photo']) : ?>
<?php foreach ($record['top_photo'] as $index => $upload): ?>
<p><a href="<?php echo $record['_link'] ?>">
<img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<br />
<?php echo htmlencode($record['title']) ?>
</p>
<?php endforeach ?>
<?php endif; ?>
<?php endforeach ?>

See if that accomplishes what you need to do.

~ Deborah