Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hello! I am using the Couch events calendar for the first time and am wondering if my client's requirements are going to be impossible to achieve. The site is for a Festival with events in November, but some events could fall in October and December. We want to display a calendar grid showing events which when clicked will go through to the detail event page.

When the programme of events is announced in May we will want to show the calendar for the month of the first event i.e. October or November. I can do that by setting the cms:calendar date parameter.

BUT this is where it goes a bit pear-shaped ... when the date parameter is set the paging from month to month via k_prev_calendar_date and k_next_calendar_date doesn't work - we are stuck in the month set up in the cms:calendar date parameter.

Can anybody suggest a solution to this?

Thanks!
Hi potato,

when the date parameter is set the paging from month to month via k_prev_calendar_date and k_next_calendar_date doesn't work - we are stuck in the month set up in the cms:calendar date parameter.
So suppose you set the date for November, is it that the next and prev links don't point to December and Oct. respectively? Or they do but you'd want them to point to some other months?

Could you please clarify? If the site happens to be online, allow me to take a look at the page.

Thanks.
Sorry for not making it totally clear - the site is at the early stages of development and only local.

The next and prev links are correctly set to December and October but because of the 'date' parameter set up in cms:calendar when the next or prev links are clicked we stay stuck on November rather than moving on or back in time.
Code: Select all
<cms:calendar masterpage=k_template_name date='2015-11-01' show_future_entries='1' >


I am grappling with trying to force the display of a future month and to then allow paging back and forward through adjacent months.
OK, I get it now. Thanks.
Don't spend any more time on it :) I'll study the problem and get back.
@potato,

If you take a look at the example used in the docs (http://www.couchcms.com/docs/concepts/e ... endar.html), the 'date' parameter is set dynamically using value from the URL's querystring parameter named 'cal' -
<cms:calendar date="<cms:gpc 'cal' />" masterpage=k_template_name show_future_entries='1' >

The 'next' and 'prev' links work by manipulating the 'cal' querstring parameter -
<th><a href="<cms:concat k_page_link '?cal=' k_prev_calendar_date />"> << </a></th>
...
<th><a href="<cms:concat k_page_link '?cal=' k_next_calendar_date />"> >> </a></th>

When the page is accessed with no such parameter (as when accessed for the first time), the current date is automatically used by cms:calendar.

For your case, we can change the logic a little to check for a blank 'cal' parameter and specifically set it to the future date you wish.

The revised code would now become -
Code: Select all
<cms:set cal="<cms:gpc 'cal' method='get' />" />
<cms:if cal='' >
    <cms:set cal='2015-11-01' />
</cms:if>

<cms:calendar date="<cms:show cal />" masterpage=k_template_name show_future_entries='1' >
   ...
   ...

Hope this helps. Please let me know.
THANK YOU so much - I had been trying with a variable - but was clearly doing something wrong. I'm very grateful for your help!
You are always welcome, potato :) I'm glad I could help.
7 posts Page 1 of 1