Grouping listings by month with header

4 posts by 3 authors in: Forums > CMS Builder
Last Post: November 3, 2008   (RSS)

Re: [gkornbluth] Grouping listings by month with header

By Kenny - October 26, 2008 - edited: October 26, 2008

Here's one built in a table you could use:

You'll need to replace my code with your code -

<table>
<?php
$lastCategory = "";
foreach ($eventRecords as $record):
$showHeader = false;
if ($record['month'] != $lastCategory) {
$lastCategory = $record['month'];
$showHeader = true;
}
?>
<?php if ($showHeader): ?>
<tr>
<td><?php echo $record['month'] ?></td>
</tr>
<?php endif ?>
<tr>
<td><?php echo $record['title'] ?></td>
</tr>
<tr>
<td><?php echo $record['content'] ?></td>
</tr>
<?php endforeach; ?>

</table>


Hope that helps -

Kenny

Re: [gkornbluth] Grouping listings by month with header

By InHouse - November 3, 2008

Re: [Judis] Grouping listings by month with header

Thanks for finding this.

I'll give it a try along with Kenny's ideas and let you know how it works out.

Jerry
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