Plog Template Update – December 13, 2004
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.
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.
Questions? Have Anything to Add?
(your comments will be published on this site - click here for private questions)

Posted by
oscar
on December 16, 2004, 2:07 am

Posted by
jondaley
on December 16, 2004, 9:51 am

Posted by
oscar
on December 16, 2004, 1:15 pm

I had been thinking about removing more of the dynamic content (# of visitors currently online, etc) in order to be able to cache things better.
I was wondering about keeping track of the timestamp the last time something in the database had been changed, and then returning 304 if the dates were all right.
The last thought I had had was that there is some content that doesn't really matter if it changed, depending on what page you are looking at, so I was wondering how hard it would be to see what content matters for this page, and had figured that was sort of hard, so hadn't thought about it any more.
I wonder if this conversation should be moved to plogworld (if there is anything more to say), to benefit people there too...
Posted by
jondaley
on December 16, 2004, 1:23 pm