Calendar block questions
Permalink
Hey,
I've bought the calendar block for my client's site.
I like using the different views,
but I don't like the agenda view as I don't like the set box height and the scroll bar on it if there are lots of events.
So i've used the list view but my only problems are, I liked having a link to the events indivual page and I want to limit the events just in case there are loads that end up trailing off the page.
So in summary how do I set up the list view so that each event is linked to its page and how to do I limit the number of events listed?
Thanks so much in advance
I've bought the calendar block for my client's site.
I like using the different views,
but I don't like the agenda view as I don't like the set box height and the scroll bar on it if there are lots of events.
So i've used the list view but my only problems are, I liked having a link to the events indivual page and I want to limit the events just in case there are loads that end up trailing off the page.
So in summary how do I set up the list view so that each event is linked to its page and how to do I limit the number of events listed?
Thanks so much in advance
Hi Ryan.
What would I change in this code if I just wanted to display the next 3 events?
What would I change in this code if I just wanted to display the next 3 events?
You could just stop the loop after 3 lines:
<table class="ccm-calendar-all" cellspacing="0" cellpadding="0" border="0"> <tr> <th width="100%">Event</th> <th>Date/Time</th> </tr> <? $i = 0; foreach($eventObjList as $ce) { $i++; ?> <tr> <td class="ccm-calendar-all-name"><strong><a href="<?=View::url($ce->getCollectionPath());?>"><?=$ce->getCollectionName()?></a></strong></td> <td class="ccm-calendar-all-date-time"><?=$ce->getDateString();?></td> </tr> <?
Viewing 15 lines of 25 lines. View entire code block.
Thanks Ryan! You're a lifesaver.
Create the file and directories:
[your site's root]/blocks/calendar/templates/linked_list.php
Concrete will pick that up as a custom template for the calendar block.
Add this code to the linked_list.php file:
The $eventObjList variable is an array of calendar events (they extend pages & collections) and you can loop through that & display how you'd like.
To display this template, click on an existing calendar block and then select "Choose Custom Template" and from the drop-down your template will be listed.