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 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

By kyle - May 13, 2013

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