Display Multi Record List if Checkbox is 1

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 26, 2009   (RSS)

By (Deleted User) - October 25, 2009

Hi, I am building a tour page and have a number of multi record tours. I have added a checkbox to the section editor to allow the multi record to be included on the home page.

On the home page I have 2 slots available for tours. The home page is a normal detail page with 'perPage' => '2', to restrict the amount of multi records showing.

I then have a load of divs and echo's within the <?php foreach ($guided_tourRecords as $record): ?> here <?php endforeach; ?>

It works well at the moment and is ordered with the next tour first in the list using it's date.

How would I do the same but IF a tour checkbox is ticked it displays that tour instead of the dated ones above? Ideally if only 1 was checked it would be great to show one standard as per the date and the one which is checkboxed??

Thanks Jono.

Re: [jonoc73] Display Multi Record List if Checkbox is 1

By Dave - October 26, 2009

Hi Jono,

So let me see if I've got this right. You want to show 2 tours on the homepage, and you want the featured or checked tours first (if there are any) followed by the rest (sorted by date).

The simplest way to do that is to sort by your checkbox field first, and then date. I'll assume your checkbox field is called "featured" and your date field is called "date" but use your actual fieldnames in your code.

Under: Admin > Section Editors > Your Section > Sorting, enter:
featured DESC, date DESC

This means: sort by featured in descending order, and then by date in descending order.

Hope that helps! Let me know if that does what you need.
Dave Edis - Senior Developer
interactivetools.com