Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi,

I'm modifying your event calendar example to work with my own site and I'm having an issue.

So far I have managed to get the small calendar to work, but the issue comes when I click on a date with a linked event to drill down to.

If I click on a calendar day, it always seems to open the events.php as a list, rather than a page. The query string is "events.php?d=20120120" and for this page:

k_is_list: 1
k_is_page: 0
k_is_archive: 1

Is this because events.php is trying to list all events for that date? I'm unlikely to have more than one event per date, so ideally would like to be able to do the following when the user clicks on a date in the small calendar:

Pseudo Code
Code: Select all
if k_count_entries = 1
<link to events.php showing the only event for that day>
else if k_count_entries >1
<link to events.php showing all events for that day>
/*I'm guessing this is what it is doing now */
else
<no links to display>


The difficulty is this bit --> <link to events.php showing the only event for that day> I don't know what variable to use to link to just that page.

Many thanks for your help.

Mark
Hi,

Here is a slightly modified code that is present in the documentation -
Code: Select all
<cms:calendar masterpage='events.php' show_future_entries='1' >
    <table class="calendar_small">
        <tr>
            <th colspan="7"><cms:date k_calendar_date format='F Y' /></th>
        </tr>
        <tr>
            <cms:repeat count='7'>
            <td class="months_heading"><cms:zebra 'Su' 'M' 'T' 'W' 'Th' 'F' 'S'/></td>
            </cms:repeat>
        </tr>

        <cms:weeks>
            <tr>
            <cms:days >
                <cms:if k_timeline_position='present'>
                    <cms:set tdclass='today' />
                <cms:else />
                    <cms:set tdclass='' />
                </cms:if>
               
                <cms:if k_position='current_month' >
                    <cms:if k_count_entries >
                         <td class='entries <cms:show tdclass />' >
                          <cms:if k_count_entries='1'>
                              <cms:entries limit='1' skip_custom_fields='1'>
                                 <a href="<cms:show k_page_link />"><cms:show k_day /></a>
                              </cms:entries>
                          <cms:else />
                                 <a href="<cms:link masterpage='events.php' year=k_year month=k_month day=k_day />"><cms:show k_day /></a>
                          </cms:if>
                      </td>
                    <cms:else />
                        <td class='<cms:show tdclass />' ><cms:show k_day /></td>
                    </cms:if>
                <cms:else />
                    <td class='other_month'><cms:show k_day /></td>
                </cms:if>
            </cms:days>
            </tr>
        </cms:weeks>
    </table>
</cms:calendar>

The <cms:if k_count_entries > block checks if the number of entries is exactly 1. If yes, it generates link to the 'page-view' of that entry. If more than one, the 'archive-view' link is generated.

Hope this helps. Do let me know.
Thanks, KK, that fixed it. Your support as always is awesome.

Regards,

Mark
3 posts Page 1 of 1

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 9 guests