Hi All,
I'm trying to code the new date tag we talked about earlier, but as
I'm new to ruby, I'm posting the code for you to have a look.
desc %{
Renders the actual date or the date the page was published, created or updated
(in the event that it has not been published yet, the date that it
was created).
The format attribute uses the same formating codes used by the Ruby
@strftime@
function. By default it's set to @%A, %B %d, [EMAIL PROTECTED]
*Usage:*
<pre><code><r:date [which="date_type"] [format="format_string"]
/></code></pre>
}
tag 'date' do |tag|
page = tag.locals.page
format = (tag.attr['format'] || '%A, %B %d, %Y')
if tag.attr['which']
if (tag.attr['which'] == 'now')
date = Date::Time.now
else
which = tag.attr['which'] # are this two lines correct?
date = page.which # i don't know if it's the way to do it
end
else
date = page.published_at || page.created_at
end
date.strftime(format)
end
date_type would be [created_at | published_at | updated_at | now]
I need some help
Thanks,
Gabriel
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant