Mixed List and Page View Behaviour

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 14, 2008   (RSS)

By InHouse - April 14, 2008

Maybe I'm just suffering from Monday-Brain here, but I'm stuck on trying to get the best of both worlds. I'd like to have a mix of the Page View and List View functions on one page.

Example: A single page which, when first loaded, shows a single article from a multi-page editor. Ideally, that article need not be the num=1 article like the current Page View, but could be selected by a field value (i.e.: featured = 1, or a date DESC condition). That same page should also support a List View of all that table's articles. When one of these links is clicked, the page is reloaded and the new article will be only one shown.

I can get almost all of this, but I'm dependent on the recordNum being 1 for the first shown article. I'd like to have more control over this. If I use the WHERE clause to pick the first-shown article, I lose the function of the archive list for subsequent page loads.

Any ideas?

Jayme

Re: [InHouse] Mixed List and Page View Behaviour

By Dave - April 14, 2008

Hi Jayme,

It's been requested a few times to have a way to default the page viewer to a certain record. I'm going to update the page viewer for the next version to default to showing the first record (sorted by 'orderBy') instead of record 1. So you're code will look like this:

$options['recordNum'] = '';
$options['where'] = '';
$options['orderBy'] = 'featured=1, date';


If a record number is defined in the url it will use that, if not, it will load the first record that comes up when sorting by the order by.

I know you're testing the multi-section sort so I'll include that code in the next update I send you shortly.

Also, for your list viewer on the same page, you want to hard code the page number and where so it doesn't pick up any values from the url. Like this:

$options['perPage'] = '9999'; // show all records
$options['pageNum'] = '1'; //
$options['where'] = '1'; // ignore search queries in url


I'll send you an updated viewer_functions.php and then the above code will work with orderBy for the page viewer.

Hope that helps!
Dave Edis - Senior Developer

interactivetools.com