On 8/17/2010 10:19 AM, ACME Media Farm wrote:
Hello Everyone. I understand that you can use a different template for
each of your posts, but I couldn't find any information abut per
post .css - is it possible to have a different template and .css for
each post?
It depends how your theme is configured.
If your theme is set up like any of the core themes, you can add a
couple of lines before the first line of the file, which is the line
that displays the head section of the output page.
<?php
if($request->display_entry && isset($post)) {
Stack::add('template_stylesheet',
array(
Site::get_url('theme', '/entry-' . $post->id . '.css'),
'screen')
);
}
?>
That will check to make sure that the request was for a single entry and
that a post was set, then add a stylesheet to the stack for that
particular entry.
Note that this doesn't check to see if the stylesheet file exists. You
can get the filename of the css file with Site::get_path() and check
that before adding the stylesheet.
If your theme isn't configure like the core themes (as with most of my
own themes, it turns out), then this is a little more difficult. But
see if that works for you first.
Owen
--
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-users