4 posts by 3 authors in: Forums > CMS Builder
Last Post: May 13, 2013   (RSS)

By gkornbluth - May 10, 2013 - edited: May 10, 2013

Hi Kyle,

I'm not exactly sure what you're describing, but you can re-declare your load records call in different parts of the body of a viewer and achieve results based on different parameters

IE:

<?php list($e_blast_events_noticeRecords, $e_blast_events_noticeMetaData) = getRecords(array(
    'tableName'   => 'e_blast_events_notice',
  'orderBy'=> 'neverRemove ASC, event_start_date ASC',

  ));

?>
<body>
Viewer code based on parameters above...

for one purpose, and later in the body

<?php
    list($e_blast_events_noticeRecords, $e_blast_events_noticeMetaData) = getRecords(array(
    'tableName'   => 'e_blast_events_notice',
      'where' => '((NOW() + INTERVAL 7 DAY) >= opening_reception_date_and_start_time AND opening_reception_date_and_start_time >= TIMESTAMP(CURDATE(), "00:00:00")) OR ((NOW() + INTERVAL 7 DAY) >= event_start_date AND event_start_date >= TIMESTAMP(CURDATE(), "00:00:00")) AND apbc_event != 1',   
      'orderBy'=> 'neverRemove ASC, event_start_date ASC',
      ));  
      
    ?>

Viewer code based on these parameters

For another.

Hope that gives you some ideas,

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

I don't know what version of CMSB you are using, but the latest version has a code generator to do exactly that.  Along with single and list pages, it creates a combo page.  You may want to update to the latest version.  Otherwise, simply create 2 viewers, one to grab the detail record and one to create the list you just came from to display in the footer.

  // load detail record from 'news'
  list($newsRecords, $newsMetaData) = getRecords(array(
    'tableName'   => 'news',
    'where'       => whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $detailRecord = @$newsRecords[0]; // get first record
  if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found

  // load list records from 'news'
  list($newsRecords, $newsMetaData) = getRecords(array(
    'tableName'   => 'news',
    'loadUploads' => false,
    'allowSearch' => false,
  ));

Of course, you may have to alter the list code to properly filter or sort it to your liking.

Hope this helps!

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

Thanks so much, that combo page did the trick perfectly :)