Re: Creating a Dynamic PHP/CSS Page (newbie design question)

From: Date: Thu, 05 Nov 2009 16:22:43 +0000
Subject: Re: Creating a Dynamic PHP/CSS Page (newbie design question)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-299651@lists.php.net to get a copy of this message
On Thu, 2009-11-05 at 08:06 -0800, cool@hosting4days.com wrote: > Hi Folks, > > My goal: is to have a template form to control css styles, where the > user fills out choices in a template form page and the results might > get stored in a MysQL prefs table. > > But I guess you can't have php mixed with .CSS page ... so is the > best way to do this like: ...? > > - set a a normal mystyle.css style sheet with no php but with all > possible choices > > - then - on the css prefs form page you might have choices like: > > fontsize = small or med or big etc. then you might store the 'actual' > css name (on the real css style sheet) associated with the choice like : > style = "HEADER1" or whatever based on the choice > > > then let's say I have a page: > > mypage.php > > that links to a css style sheet: > > mystyle.css > > - then the php page might use it like: > > class = "<?php echo $thischoice; ?>" for "HEADER1" > > Q: Is that the best way to setup dynamic css choices using php? > > Any comments would be appreciated - dave > > > Thanks, > cool@hosting4days.com > > > > > > You can point your stylesheet link to a PHP file like this: <link type="stylesheet" href="css.php" type="text/css"> and then in your PHP script, make sure you set your output header type to text/css like so: header("Content-Type: text/css"); That way, your PHP script can output exactly what CSS you require. Thanks, Ash http://www.ashleysheridan.co.uk

« previous php.general (#299651) next »