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

By kyle - May 10, 2013

Howsit everyone 

Iv been scouring the forum for a few days now and I'mstill left clueless

I'm trying to have a multi record detail page that has a list section of the same record in it
So, you would click on the article you want to view  more of (Standard list page), which sends you to the detail page and in the footer of the page there is suppose to be a list with all the other atricles in this section

Iv got a somewhat working system, but the fact that a detail page has a limit of 1 is preventing my list section from displaying all records that are related

Any ideas, hints, suggestions and so on are greatly appreciated :)

Thanks in advance :) 

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

By rconring - May 11, 2013

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