Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Greetings!

I am using the couchcms calendar.
By default we can view the calendar and it shows (in a month) highlighted dates where there are event entries. I would want to be able to:
1. Start with a calendar displaying the current (today) date and a list on the side showing event posts on that day or a message stating there are no events (if there are indeed no events)
2. Then when a particular date is clicked, it must display only the list of events on that day or a message stating there are no events (if there are indeed no events).

Can this be achieved?

Regards,
GXCPL (CTR Support)
Image
where innovation meets technology
I think you can list all events in a div per day, e.g.
Code: Select all
<div id="events20220828">Welcome party</div>
<div id="events20220829">Sunset tour</div>

and hide/show divs upon clicking of each day (JS).
@trendoman

Thanks, your suggestion works.

But I went ahead and implemented a few more things to have better control.
This is what I have (please dont mind the variable names):
Code: Select all
<cms:calendar date="<cms:gpc 'cal' />" masterpage=k_template_name show_future_entries='1' start_on="<cms:date 'first day of this month' format='Y-m-d' />" stop_before="<cms:date 'last day of this month' format='Y-m-d' />" >
    <cms:set display_list="<cms:gpc 'd' />" scope="global" />
    <cms:set else_display_list="<cms:gpc 'cal' />" scope="global" />
    <cms:if display_list >
        <cms:set display_list_string=" | ctr_indate=<cms:date "<cms:gpc 'd' />" format='Y-m-d' />" scope="global" />
    <cms:else_if else_display_list />
        <cms:set dm="<cms:date "<cms:gpc 'cal' />" format='Y-m' />" scope="global" />
   <cms:set display_list_string="| ctr_indate >= <cms:date else_display_list 'first day of this month' format='Y-m-01' /> | ctr_indate <= <cms:date "<cms:show dm /> last day of this month" format='Y-m-d' />" scope="global" />
    <cms:else />
        <cms:set display_list_string="| ctr_indate>=<cms:date 'first day of this month' format='Y-m-d' /> | ctr_indate<=<cms:date 'last day of this month' format='Y-m-d' />" scope="global" />
    </cms:if>
    <cms:pages masterpage='index.php' custom_field="ctr_owner=<cms:show k_user_name /><cms:show display_list_string />" order='asc' orderby='ctr_indate' show_future_entries='1'>
        <!-- Login to display output, I have used bootstrap 5 accoidion -->
    </cms:pages>
</cms:calendar>


Regards,
GXCPL (CTR Support)
Image
where innovation meets technology
You are welcome, Arjun

Given the posted code, you will have an issue with cal date from a different month.

If someone chooses to see events from May you should change the start_on and stop_before parts —
Code: Select all
<cms:date '2022-05-25 first day of this month' format='Y-m-d' />, which then works properly as →
<cms:date "<cms:gpc 'cal' /> first day of this month" format='Y-m-d' />
4 posts Page 1 of 1
cron