Forum

Thread tagged as: Events

Multiple Calendars with Perch events app

So what I am trying to do is have 3 calendar one with previous months events, currant months events and the next months events.

<div class="col-md-4">
<div class="month"><perch:events id="prev_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>


<div class="col-md-4">
<div class="month"><perch:events id="current_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>


<div class="col-md-4">
<div class="month"><perch:events id="next_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>
David Henderson

David Henderson 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok - what problem are you running into?

I am able to output the calendars and each months heading but the calendars all showing the current month. I need them to show the relevant calendar to the heading. So say the headings are June July August I need to show the calendars that represents them heading.

I have still had no luck with this any ideas ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What code do you have currently, and how is it failing?

Hi Drew thanks for your help.

Below is the code I currently have and it is failing as it is showing the same month for each calendar, I need 3 calendars showing the prev month, current month and the next month events.

<div class="col-md-4">
<div class="month"><perch:events id="prev_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>


<div class="col-md-4">
<div class="month"><perch:events id="current_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>



<div class="col-md-4">
<div class="month"><perch:events id="next_month" format="%B %Y" /></div>

<table class="calendar">
    <thead>
        <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
</div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What page functions are you using to display this?

I am just using:

<?php perch_events_calendar(); ?>

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to do this:

<?php

    $_GET['d']  = date('Y-m', strtotime('-1 MONTH'));
    perch_events_calendar();

    $_GET['d']  = date('Y-m');
    perch_events_calendar();

    $_GET['d']  = date('Y-m', strtotime('+1 MONTH'));
    perch_events_calendar();

?>

Thanks for your help Drew