If you're on edge, you might also consider the PageParts extension. It
can be used to add a dedicated datetime field to a page (instead of
storing dates as text, or repurposing published_at.) It also provides
some new tags like if_earlier/if_later for working with datetime fields.
j
On Jun 18, 2010, at 9:30 AM, Matt Spendlove wrote:
Thanks Jim.
I realise that it's a unusual usage as News items are normally either
current or past but the thinking was they'd post a News item as at
"today" referring to an upcoming event. Perhaps we'll have to rethink
this..
Matt
On Jun 18, 2:21 pm, Jim Gay <j...@saturnflyer.com> wrote:
On Fri, Jun 18, 2010 at 8:44 AM, Matt Spendlove
<matt.spendl...@gmail.com> wrote:
Hi all
I have a News page of archive page type. Users can tag the pages
into
"news", "events", "offers" etc.
I'd like to be able to show upcoming events in a sidebar.
I can search for all items tagged with "events" and display them,
but
how do I show only events where <r: date> >= TODAY ?
I didn't really want to go down the route of using a dedicated
calendar extension [1] as it's overkill for the requirements. I
can't
see to be able to do any kind of conditional fiter on the date?
Your thoughts appreciated.
Matt
[1]http://github.com/davec/radiant-events-calendar-extension
There's no notion of "upcoming" with the archive pages.
To do this, you'll need to create an new tag (in a custom extension).
Here's some quick code that should get you along:
tag 'upcoming' do |tag|
tag.locals.upcoming = Page.all(:conditions => ['whatever_date
> ?',Time.now]
tag.expand
end
tag 'upcoming:each' do |tag|
result = []
tag.locals.upcoming.each do |page|
tag.locals.page = page
result << tag.expand
end
result
end
--
Jim Gay
Saturn Flyer LLChttp://www.saturnflyer.com
571-403-0338