[thelist] Variable Stylesheets?

Keith cache at dowebs.com
Mon Dec 3 01:44:50 CST 2001


> YA Baby! Programmable stylesheets!

I don't use ASP, but your niffty trick can also be used with perl and ssi

<!--#set var="qs" value="$QUERY_STRING" --> 
<link rel=STYLESHEET href="style.cgi?<!--#echo var="qs" -->" 
type="text/css">

However, the only thing I can see that's gained over setting the style 
directly through ssi is the supposed "cacheability". But I don't think you are 
getting the cachability that you think you are. The browser still calls it 
everytime I refresh the page. I put a sleep(90) in style.cgi and everytime I 
refresh the page I get a 90 second wait to load the page.  This pause 
happens on IE5.5 and NN4.7 even if they are set to never check for newer 
versions on the server. Obviously they're checking.... In fact, both browsers 
still check for newer versions (and get them) even if .css is used in a static 
linked stylesheet even with check for newer versions set to never. Linked 
stylesheets have other weird behavior regarding tainted values from the 
environment so maybe browsers do not treat them as expected in other 
areas, such as "cachability". All I'm saying is, Check your premise Lon, my 
milage varied.

If the stylesheet does not cache, then

<style type="text/css">
<!--#include virtual="style.cgi" -->
</style>

would be more efficient. In an embedded stylesheet style.cgi can pick up 
the query_string right from the environment with 
QUERY_STRING_UNESCAPED and ASP probably can too. Convenient 
place to pick it up too since HTTP_COOKIE is there too if you want to 
make this effective site wide.

I'm not too certain how many visitors might actually hang around on sites to 
play with a fully programmable stylesheet. I've used a similar ssi trick to 
give visitor's changeable font sizes for blocks of text.

<div style="font-size:<!--#echo var="QUERY_STRING" -->px">
<a href=<!--#echo var="DOCUMENT_NAME" -->?16>larger text</a>
<a href=<!--#echo var="DOCUMENT_NAME" -->?13>default text</a>
<a href=<!--#echo var="DOCUMENT_NAME" -->?10>smaller text</a>

There may be other pluses to your Variable Stylesheet Lon and maybe 
there are ways to cache it with ASP. Keep hammering at it, even if it 
doesn't cache, it still looks useful for someone using ASP.


keith





More information about the thelist mailing list