Listing event records under a date

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

Hello,

I'm trying to create a simple list of calendar events, but I'm having a couple of issues. Right now I have this foreach statement listing my events:

--------------------------------------------------------

            <?php foreach ($calendar_eventsRecords as $record): ?>
                <p><strong><?php echo date("l, F j", strtotime($record['date'])) ?></strong> <br/>
          
                <?php echo date("g:i a", strtotime($record['date'])) ?> (<?php echo $record['duration:label'] ?>) - <a href="#" class="tooltip" title="<?php echo $lessonsRecord['content']; ?> <?php echo htmlencode($record['content']) ?>"><?php echo $record['title:label'] ?></a></p>
        
            <?php endforeach ?>

--------------------------------------------------------

This produces the output:

Friday, July 19
10:00 am (2 hours) - Event Name

Friday, July 19
6:00 pm (2 hours) - Event Name

Saturday, July 27
10:00 am (2 hours) - Event Name

etc.

This is the output I need, with events listed under the date without the date repeated.

Friday, July 19
10:00 am (2 hours) - Event Name
6:00 pm (2 hours) - Event Name

Saturday, July 27
10:00 am (2 hours) - Event Name

Can you please tell me how I can create a loop for the events after the date output?

Thanks,Chris