Re: CSS as PHP

From: Date: Tue, 22 Oct 2002 21:13:46 +0000
Subject: Re: CSS as PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120983@lists.php.net to get a copy of this message
you can definitely put your styles in a .php file. just remember that the visible output of the file has to be valid css jargon... in your example, you'd have to wrap the BODY{...} line in an echo or print call. as far as your html pages go, the <link> tag doesn't discriminate based on file name as far as I can tell. you can even pass parameters to the css file if you use the <link> tag: <head> <link rel="stylesheet" type="text/css" href="/path/to/mycss.php?paintItRed=1"> </head> and in mycss.php: BODY { background-color: #<?= ($_GET['paintItRed']) ? "FF0000" : "FFFFFF" ?>; } "Liam Gibbs" <Liam.Gibbs@dfait-maeci.gc.ca> wrote in message news:D64360C926B9F34F8B35F78D07B8E7A2716CD8@postman.dfait-maeci.gc.ca... > Can a CSS be written in PHP? > > For instance, can I store my style-sheet in Stylesheet.php as > > <?PHP > BODY { Text-Align: Justify; } > . > . > . > ?> > > And have it work?

« previous php.general (#120983) next »