Issue
For example, I have this CSS script:
<style>
.header{
background:none:
color:#fff;
}
</style>
Then, I would like to change the header value to:
<style>
.header{
background-color:#fff:
color:#000;
}
</style>
The values are stored in database. What makes me confused is which should be the best to do that: Using PHP script or CSS or even javascript. I want it changed based on the CSS value from my database which I can change again when I need it (by using PHP script). Perhaps this question is too general but, please give me some scripts which I can perform it well. Thanks for any help.
Solution
first, change the extension of your file from (e.g.) style.css to style.php . Then add this to the first line of your css:
<?php
header('Content-Type: text/css');
?>
and after that you can define the value of your background as a variable and change it easily.
background: <?php echo $value; ?>
and in your php file:
<?php value = "#fff"; ?>
UPDATE:
<?php $value = "#fff"; ?>
Answered By - Majid Sadr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.