Current and Archive lists on the same page

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 25, 2013   (RSS)

By MercerDesign - July 24, 2013

I have got a Multi List that is going to display bulletins, I need it to display a current issue and then archived issues on the same page but in different lists, I have created 2 check boxes: Current and Archive, the table name is babington_bulletin, but I cannot get the 2 lists to display. Please can anyone help.

By gregThomas - July 24, 2013

Hi, what about doing two different getRecords calls with a where statement that retrieves the current and archive checked records only?

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('C:/wamp/www/test/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from 'blog'
  list($currentRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'babington_bulletin',
    'loadUploads' => true,
    'allowSearch' => false,
    'where'       => "`current` = 1",
  ));

    // load records from 'blog'
  list($archiveRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'babington_bulletin',
    'loadUploads' => true,
    'allowSearch' => false,
    'where'       => "`archive` = 1",
  ));

This is just example code, so you might have to make a few changes to get it working with your page.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By MercerDesign - July 25, 2013

Ok, but how do I get the 2 lists to display separately, current in one area and archive in another, it seems I need to put a where statement or something on the actual page where the content displays.