On Jan 19, 2011, at 6:21 PM, Michael Bishop wrote:
> I believe the theme template system already supports date based templates,
> which you can set specific classes for and then style the page differently.
> You could completely alter the page layout for that matter.
> http://wiki.habariproject.org/en/Template_File_Hierarchy#Display_entries_by_date_.28.2F2007.2F12.2F02.29
The date-based templates would only get loaded if act_display_date is called,
which wouldn't be true (by default, anyway) of an individual post, just
/yyyy/dd/mm archives pages.
That said, I actually like this idea better than creating whole new themes. You
could add a filter_template_fallback() method to your theme.php, which as of
just now (r4800) gets handed $posts and $post. Look at the $post->pubdate (be
sure $post != null first) and modify $fallback before you return it so your
custom templates are at the top (and would match first).
For example:
public function filter_template_fallback ( $fallback, $posts, $post ) {
if ( $post != null ) {
if ( $post->pubdate > HabariDateTime::date_create('1/1/2010') )
{
// make sure post.theme1 is the first choice of
templates for posts after 1/1/2010
array_unshift( $fallback, '{$type}.theme1' );
}
else if ( $post->pubdate >
HabariDateTime::date_create('1/1/2009') ) {
// .. similar, for posts after 1/1/2009, but before
1/1/2010, and so on...
}
}
// always return $fallback, whether we modify it or not
return $fallback;
}
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev