Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
My monthly calendar displays just the way I want it, but I need it to always represent the current month plus 2 months. So if this is December, it should display February.

This is what I've tried so far but it doesn't work:
Code: Select all
<cms:calendar >
   <cms:set next_month = k_next_calendar_date 'global' />
   <cms:add next_month '1' />
   <cms:show next month />
</cms:calendar>

<cms:calendar date=next_month masterpage='events.php' show_future_entries='1' >
   <cms:date k_calendar_date format='F Y' />
</cms:calendar>


Both instances of "calendar" display the same month.

Suggestions?
Try this -
Code: Select all
<cms:calendar >
    <cms:php>
        global $CTX;
        $current_month = @strtotime( $CTX->get('k_calendar_date') );
        $next_month = @date( 'Y-m-d', @strtotime("+2 month", $current_month) );
        $CTX->set( 'next_month', $next_month, 'global' );
    </cms:php>
</cms:calendar>

<cms:calendar date=next_month masterpage='events.php' show_future_entries='1' >
   <cms:date k_calendar_date format='F Y' />
</cms:calendar>

Hope this helps.
THX - works great. I'll post a link to the site when it's finished.
3 posts Page 1 of 1