Hi, I’m using the Calendar plugin by @molocLab and running into a problem which I can seem to work around.
I’m trying to integrate this with @bastianallgeier calendar plugin which is working fine. I’m currently showing a month view and have the calendar working in the panel however when I try and output any events into the calendar I’m getting issues.
This is the code at present:
<?php foreach($currentMonth->weeks(6) as $week): ?>
<tr>
<?php foreach($week->days() as $day): ?>
<td<?php if($day->month() != $currentMonth) echo ' class="inactive"' ?>><?php echo ($day->isToday()) ? '<strong>' . $day->int() . '</strong>' : $day->int() ?>
<?php foreach($pages->find('calendar/year-2016/day-2016-07-25')->events()->toStructure() as $event): ?>
<div class="item">
<?php echo $event->topic()->html() ?>
</div>
<?php endforeach ?>
</td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
The above code works as intended by repeating the event over the course every day of the month.
I then changed the foreach loop to the following to try and change the date for each day:
<?php foreach($pages->find('calendar/year-2016/day-2016-07-' . $day->int())->events()->toStructure() as $event): ?>
When I change the code in the loop to make it work for each day i get the following error:
27
Fatal error: Uncaught Error: Call to a member function events() on boolean in /srv/users/chris/apps/01- home/public/projects/vd/site/templates/calendar.php:53 Stack trace: #0 /srv/users/chris/apps/01-home/public/projects/vd/kirby/toolkit/lib/tpl.php(22): require() #1 /srv/users/chris/apps/01-home/public/projects/vd/kirby/kirby/component/template.php(85): Tpl::load('/srv/users/chri...', NULL, true) #2 /srv/users/chris/apps/01-home/public/projects/vd/kirby/kirby.php(619): Kirby\Component\Template->render(Object(Page), Array) #3 /srv/users/chris/apps/01-home/public/projects/vd/kirby/kirby.php(607): Kirby->template(Object(Page), Array) #4 /srv/users/chris/apps/01-home/public/projects/vd/kirby/kirby/component/response.php(29): Kirby->render(Object(Page)) #5 /srv/users/chris/apps/01-home/public/projects/vd/kirby/kirby.php(686): Kirby\Component\Response->make(Object(Page)) #6 /srv/users/chris/apps/01-home/public/projects/vd/index.php(16): Kirby->launch() #7 {main} thrown in /srv/users/chris/apps/01-home/public/projects/vd/site/templates/calendar.php on line 53
Is there something glaringly obvious I’m missing here?
Ta