On 24 Nov 2009, at 22:10, [email protected] wrote:
> It looks like it filters the events by date in the same manner as the blog
> archive page type filters blog posts by date.
Just replying to myself incase this proves useful for anyone.
The Archive Events page does indeed work like the Standard Archive page types
and allow you to list events filtered by start_date, however the tags for the
Event Day page seem to return events for the entire month, instead of for a
single day, instead of what the archive title indicates.
Here are some amendments to the event_day_index_page.rb page that seem to
correct that and list events just for a single day.
class << ArchiveFinder
def event_day_finder(finder, year, month, day)
new do |method, options|
start = Time.local(year, month, day)
finish = start.tomorrow
add_condition(options, "event_datetime_start >= ? and
event_datetime_start < ?", start, finish)
finder.find(method, options)
end
end
end
tag "archive:children" do |tag|
year, month, day = $1, $2, $3 if request_uri =~
%r{/(\d{4})/(\d{2})/(\d{2})/?$}
tag.locals.children = ArchiveFinder.event_day_finder(parent.children, year,
month, day)
tag.expand
end
tag "archive:unless_children" do |tag|
year, month, day = $1, $2, $3 if request_uri =~
%r{/(\d{4})/(\d{2})/(\d{2})/?$}
if ArchiveFinder.event_day_finder(parent.children, year, month,
day).find(:all).empty?
tag.expand
end
end
The only trouble with this is that it limits all events pages to be the
children of the Events Archive page.
Another way to list all events for a single day in the future is to use the
route handlers extension and filter the events by url/date:
Route: route\/(\d{4})/(\d{2})/(\d{2})/?$
Fields: start_year, start_month, start_day
Although this means creating a page for each month of the year...
Does anyone know of a good trick to find all children of the root instead of
using parent.children?
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant