Show detail record only from the archive list

7 posts by 3 authors in: Forums > CMS Builder
Last Post: January 8, 2015   (RSS)

Hi, I have a multi list setup so that there are current courses and previous courses and am using the combo code so the list and detail is on the same page. It all works fine but on the archive page I want to show the first article from the arhive list but if I put to show the first record it shows the first record in the whole list, how can I do it so that it will show the detail from the first archive article? The links to see what I mean are: http://www.twentyfifty.co.uk/2050-training.php and http://www.twentyfifty.co.uk/training-archives/2050-training.php

Hi,

Just a guess, but if you repeat the load records call just before the code that uses it, you can change the parameters fro each group of records.

Hope it helps,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Sorry, I'm not sure what you mean. I just need to tell the archive page to just show archive detail records and not pull in ones that are ticked as current. Thanks

By claire - January 6, 2015

Hey Mercer

What you want to do is use the same getRecords call but add an additional parameter to the where clause to filter out records that are ticked as current. Do you know how to do that? If not, attach your code here and I'll take a look.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By gkornbluth - January 6, 2015 - edited: January 6, 2015

 Hi,

Sorry, what I meant was, a load records call of:

list($table_of_contentsRecords, $table_of_contentsMetaData) = getRecords(array(
    'tableName'  => 'table_of_contents',
    'where'      => " revised = '1' ",
    'limit'      => 50,
  ));
  ?>

With a foreach loop of:

<?php foreach ($table_of_contentsRecords as $record): ?>
(Your code...)
 <?php endforeach; ?>

Will limit the records loaded and displayed in the code below that list records call to 50 records  where the “revised” check box is checked.

If you put another list records call below that one with different parameters, for example

 list($table_of_contentsRecords, $table_of_contentsMetaData) = getRecords(array(
    'tableName'  => 'table_of_contents',
    'where'      => " new = '1'",
    'limit'      => 10,
  ));
  ?>


With a foreach loop of:

<?php foreach ($table_of_contentsRecords as $record): ?>
(Your code...)
 <?php endforeach; ?>

This will limit the records loaded and displayed in the code below that list records call to 10 records where the “new” check box is checked.

There are a lot or recipes in my CMSB Cookbook - http://www.thecmsbcookbook.com that use this approach and others to show different types of data on the same page.

Hope that helps...

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By claire - January 8, 2015

Hi Mercer, can you please attach the code for your viewer file here?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/