Awesome, thanks ChuckTrukk! I somehow missed that you posted this, very glad you did. I was playing with the various calendar snippets but my client has search/filtering desires that aren’t easy to set up with them... this looks like a much better place to start. Basing an events listing off of this and then setting up a jQuery based table/grid plugin for filterin, sorting, and paging should work very nicely.
Does anyone have any suggestions for a good way to approach making an event entry get output on a schedule, or as a recurring event? Say a client has an event that happens every mon, wed, fri, or an event that happens every monday between a start and end date. I prefer this approach of using a document hierarchy to manage events, but most of the snippets I’ve seen just work with a date range. For clients with an event that happens every other day for a few months it’s tedious to manually duplicate and edit a document for each date. Any pointers, even just ideas on how to approach would be appreciated! I have a lot to learn about ditto, but maybe some conditions or a call back function that checks some tv values is possible?
ChuckTrukk I noticed a bbcode error that left the Ditto-calendarMonths bit mixed in with the WF-calendarMonths code, so I’m quoting a fixed version of your post below in case anyone misses it.
Thanks again!
Quote from: ChuckTrukk at Mar 30, 2009, 04:22 AM
Alright. There is no way it should have taken this long to explain, but here goes and thanks for the patience.
Document layout
Home (1)
-- Calendar (2)
Events (3)
-- January 2009 (4)
-- -- Event One
-- -- Event Two
-- -- Event Three
-- February 2009 (5)
-- -- Event One
-- -- Event Two
-- -- Event Three
-- etc...
Content for the Calendar Page
<h1>[*pagetitle*]</h1>
[[Wayfinder? &startId=`3` &rowTpl=`WF-calendarMonths` ]]
[[Ditto? &parents=`3` &tpl=`Ditto-calendarMonths` &noResults=` `]]
WF-calendarMonths
<li class="[+wf.linktext+]">
<a class="[+wf.classnames+]" href="[*alias*]#[+wf.id+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
[+wf.wrapper+]
</li>
Ditto-calendarMonths
<tr class="month-name" >
<td colspan="4"><a name="[+id+]"><h3>[+pagetitle+]</h3></a></td>
</tr>
<tr class="heading">
<th class="date">Date</th>
<th class="name"Name</th>
<th class="type">Type</th>
<th class="location">Location</th>
</tr>
[[Ditto? &parents=`[+id+]` &tpl=`Ditto-calendarEvents` &noResults=` ` ]]
Ditto-calendarEvents
<tr>
<td class="date" nowrap>[+Event-Date+]</td>
<td class="name">
[+phx:if=`[+Event-Link+]`:isnot=``:then=`<a href="[+Event-Link+]" target="_blank">[+pagetitle+]</a>`:else=`[+pagetitle+]`+]
</td>
<td class="type">[+Event-Type+]</td>
<td class="location">[+Event-Location+]</td>
</tr>
Notes...
- When you nest snippet calls, you cannot cache both of them. I did not cache either one of them here, because the events change often
- You can use Ditto orderby to sort the items how you would like