Moshambi
11-05-2009, 08:08 AM
Hello,
I am creating a social networking site using PHP. I am using templates for the pages. I want to let the users be able to choose the colors they want for their own pages. I am curious on how I can do this using PHP. The only way I can think is to override the styles by embedding them in the page.
Example:
CSS File:
body
{
background-color: #000000;
}
Generated PHP page:
<style type="text/css">
body
{
background-color: <?php echo $color; ?>;
}
</style>
I know this is not a good idea, as it will cause pages to be very heavy. Plus I want to keep all my content and styles separate like it should be. Could anyone give me any suggestions for an alternative way?
Thanks!
I am creating a social networking site using PHP. I am using templates for the pages. I want to let the users be able to choose the colors they want for their own pages. I am curious on how I can do this using PHP. The only way I can think is to override the styles by embedding them in the page.
Example:
CSS File:
body
{
background-color: #000000;
}
Generated PHP page:
<style type="text/css">
body
{
background-color: <?php echo $color; ?>;
}
</style>
I know this is not a good idea, as it will cause pages to be very heavy. Plus I want to keep all my content and styles separate like it should be. Could anyone give me any suggestions for an alternative way?
Thanks!