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
Something like this:
<?php
if(
$request->display_entry
&& isset($post)
&& file_exists(Site::get_path(
'theme',
'/entry-' . $post->id . '.css'
)
) {
Stack::add('template_stylesheet',
array(
Site::get_url(
'theme',
'/entry-' . $post->id . '.css'
),
'screen'
)
);
}
?>
Owen