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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-11-05 at 08:06 -0800, cool@xxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxxxxx
> 
> 
> 
> 
> 
> 


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux