css in php file....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Alidad
Forum Commoner
Posts: 29
Joined: Thu Mar 29, 2007 12:42 pm

css in php file....

Post by Alidad »

Hi, I'm trying to figure out how to write that code in php, let say that i have home page that come with css color templates, each templates have one same color, yellow, blue or green.

and i created three css files, called yellow.css, blue.css and green.css. The home page set default to yellow page which yellow.css. if person want to change template color to blue and change deafult to blue, how can i write that code in php to change css file to the blue css file!

you can see sample from yahoo.com on top right, where you allow to change color of templates, I'm trying to make just like that how can i write that code to allow customer to select color and auctomatic change templates by change css file name and set default after change it!

please help!

thanks.

AM
User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Re: css in php file....

Post by allspiritseve »

Something like this should work:

Code: Select all

<link rel="stylesheet" href="styles/<?=$_GET['style']?$_GET['style']:'yellow'); ?>.css" type="text/css" />
 
...
 
<select name="style">
<option value="yellow">Yellow</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
 
Post Reply