Listing by specific date on Detail List Page

6 posts by 3 authors in: Forums > CMS Builder
Last Post: August 5, 2013   (RSS)

By nmsinc - August 3, 2013

Hi Jerry,

Thanks for the help Jerry, however, I'm coding around the zicky calendar and I have added a reminder posting for each day with listing for the entire daily schedule. What I'm trying to do is take the last date from the list and post it to the URL of a page that can be converted to PDF and printed. I know that the list page for the PDF works as I can do a full list of all reminders so using the date in the URL I thought should produce the correct results - it returns NO RECORDS found.

My full list stamen is:

list($eventsRecords, $eventsMetaData) = getRecords(array(
    'tableName'   => 'events',
    'where'           => whereRecordNumberInUrl(0),
    'loadUploads' => false,
    'allowSearch' => false,
  ));

nmsinc

Hi,

Just an idea...

If you were looking for this weeks event reminders you might be able to define  some variables and then use if statements to separate the results...

$eventdate =    strtotime($record['date']);
$dateplus0 = strtotime(date('Y-m-d', strtotime("+ 0 day")));
$dateplus1 = strtotime(date('Y-m-d', strtotime("+ 1 day")));
$dateplus2 = strtotime(date('Y-m-d', strtotime("+ 2 day")));
etc...

Then compare the variables something like:

if ($dateplus0 == $event date)

show today's events

elseif ($dateplus1 == $event date)

Show tomorrows events

elseif ($dateplus2 == $event date)

Show  events 2 days from now

Etc.

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 nmsinc - August 3, 2013

Hi Jerry,

Sorry if I have confused you. All I need to do is filter the list results by the field "date". The funny thing is; I cannot filter by any of the fields. Any field filter request I make returns all records!

nmsinc

This returned only today's events in my test and returned the correct values for the variables

<?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('/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/','','../','../../','../../../');
  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
  list($nmsinc_testRecords, $nmsinc_testMetaData) = getRecords(array(
    'tableName'   => 'nmsinc_test',
    'where' => "YEAR(date) = YEAR(NOW()) AND DAYOFYEAR(date) = DAYOFYEAR(NOW())", // limit to today's events
  ));

?>

 <h1>nmsinc test - List Page Viewer</h1>
    <?php foreach ($nmsinc_testRecords as $record): ?>
    <?PHP
$eventdate =    strtotime($record['date']);
$dateplus0 = strtotime(date('Y-m-d', strtotime("+ 0 day")));
$dateplus1 = strtotime(date('Y-m-d', strtotime("+ 1 day")));
$dateplus2 = strtotime(date('Y-m-d', strtotime("+ 2 day")));

?>

      Record Number: <?php echo $record['num'] ?><br/>
      Date: <?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?><br/>
      <!-- For date formatting codes see: http://www.php.net/date -->
      title: <?php echo $record['title'] ?><br/>
      event date: <?php echo $eventdate ?><br/>
      event date +0: <?php echo $dateplus0 ?><br/>
      event date +1: <?php echo $dateplus1 ?><br/>
      _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

      <hr/>
    <?php endforeach ?>

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

Hi Jerry and nmsinc,

Did you end up resolving this post? Were you trying to filter items in a section based on date?

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com