[thelist] Dynamically Generated External CSS file (fwd)

Martin martin at members.evolt.org
Thu Jun 7 16:40:18 CDT 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Daniel J. Cody wrote on 7/6/01 9:20 pm

>* client-side JS to detect and select a styleshee (ala
>http://lists.evolt.org/archive/Week-of-Mon-20000724/148855.html) ... but
>would prefer not to depend on JS (though, its true that if you have CSS
>support, you'll usually have JS support).

There is a certain amount of truth in that.

But you could do it with basic server side stuff.
Something like
<pseudocode>
if ($useragent = *MSIE*) {
     $css = 'ie'
} else { 
     $css = 'ns'
}
print '<link rel="STYLESHEET" type="text/css"
href="http://domain.org/styles/'
print $css
print ' -->.css">'

so only the appropriate link goes to the client.


I've done something similar with SSI and querystrings:
<link rel="STYLESHEET" type="text/css"
href="http://domain.org/styles/<!--#echo var="QUERY_STRING" -->.css">
so I can do stuff like:
http://domain.org/page.shtml?normal
or
http://domain.org/page.shtml?accessible
or
http://domain.org/page.shtml?ie

etc

so I can swap them on the fly. Once it's visible to
server-side, you can write a cookie to maintain
the preference.

It's largely what I do to enable users to choose their own font
sizes:
http://evolt.org/article/thelist/17/4415/index.html
which is a Perl interpretation of Adrian's original ASP
article:
http://evolt.org/article/thelist/22/253/index.html

Cheers
Martin

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
Comment: Content after the signature block is *not* signed

iQA/AwUBOx/zZ3HoHnCoNczLEQLT7QCglJVXWEaakjNi+hWOsTmhNoH4UTAAoMwj
OVtixi8HYwFPpsV+qZ428CRg
=eXGD
-----END PGP SIGNATURE-----


_______________________________________________
email: martin at easyweb.co.uk             PGP ID: 0xA835CCCB
       martin at members.evolt.org      snailmail: 30 Shandon Place
  tel: +44 (0)774 063 9985                      Edinburgh,
  url: http://www.easyweb.co.uk                 Scotland





More information about the thelist mailing list