Calendar

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

Re: [Toledoh] Calendar

By Toledoh - April 28, 2010

Me again :)

I've ben playing around with this today, and it works brilliantly... (although I couldn't get the JSON version to work - I'm sure we will though.)

Hard Coded: http://www.forrest.id.au/nutsnbolts/calendar/examples/test1.php

CMSB Generated: http://www.forrest.id.au/nutsnbolts/calendar/examples/test2.php

The only issue is Internet Explorer (surprise!).

my code is:
<?php foreach ($test_eventsRecords as $record): ?>
{
title: '<?php echo $record['title'] ?>',
start: "<?php echo date("Y-m-d H:i", strtotime($record['start'])) ?>"
},
<?php endforeach ?>


Which places a comma at the end of each loop - however, IE gets upset with the final record having a comma after it.

How do I get rid of that last comma?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Calendar

By Jason - April 28, 2010

Hi Tim,

You could try this:

<?php $count=0; ?>
<?php foreach ($test_eventsRecords as $record): ?>
<?php ($count)? print(",") : $count++ ?>
{
title: '<?php echo $record['title'] ?>',
start: "<?php echo date("Y-m-d H:i", strtotime($record['start'])) ?>"
},
<?php endforeach ?>


This will put a comma BEFORE each entry, except for the first one.

Give that a try.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Calendar

By Toledoh - April 28, 2010

Excellent!

This now works just fine, however as the loop is within that page, it could get a bit much.

I'll figure out the JSON feed, as this will be better for more content, and will also allow multiple feeds which would be nice.

Thanks for your help!
Cheers,

Tim (toledoh.com.au)