It had always annoyed me that you couldn't use smarty commands in the stylesheet files in plog. It turns out it wasn't that hard to figure out, and the original authors had it basically done, but if you believe the comments, didn't think it worked yet.
It is helpful to change /class/template/templateutils.class.php, specifically the "setContentType" function to read:
header("Content-Type: " . $mimeType);

Then, make a file in your template directory called style.css.template and add
{$utils->setContentType("text/css; charset=iso-8859-1")}
to the top of the file. It is important that this call be before any other html/css output (ie. in plugins too), otherwise you will get a PHP error saying that you are trying to modify the headers after the content has already started. In my case, I had written a plugin that had some stray carriage returns at the bottom, and so I had to remove those before this would work.
You should include the stylesheet from your header.template file like this:
templatePage("style.css")}" />
In your stylesheet, instead of using '{' and '}' you will need to use "{ldelim}" and "{rdelim}" because smarty is set up to parse the braces specially.
Then you can use regular smarty commands in your stylesheet files also.
posted by Jon Daley on December 13, 2004, 12:36 PM
Category Programming Internet
Comments (rss)