[thelist] CSS

Tobyn Baugher trb at cartoonviolence.net
Thu Jun 14 02:06:38 CDT 2001


On Sun, Jun 10, 2001 at 05:56:52PM -0700, Charles F. Johnson wrote:
> if you can use PHP on this site, it's pretty easy. just make links to the
> various stylesheets like so:
> 
> <a href="mypage.php?css=style1.css">Tiny fonts</a>
> <a href="mypage.php?css=style2.css">Readable fonts</a>
> <a href="mypage.php?css=style3.css">Huge fonts</a>
> 
> then in the <head> section of your page, where you'd normally put the link
> to the stylesheet, use something like this instead:
> 
> <?php
> if (isset($css)) {
>   echo "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">\n";
> } else {
>   echo "<link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\">\n";
> }
> ?>

Of course, you would never allow users to specify strings that are used
directly in your code with no input checking. This is fine for a short
example, but keep in mind that coding like this in general is a security
nightmare :)

Not that you write insecure code, I've just seen it way too much.

Regards,
Toby

-- 
Tobyn Baugher <trb at cartoonviolence.net>
http://www.cartoonviolence.net
AIM:unlewp ICQ:14281524 EFnet:trb




More information about the thelist mailing list