Welcome Guest, Not a member yet? Register   Sign In
php config variable into css files
#1

[eluser]Byzs[/eluser]
Hello to everybody, this is my first time in the forums and couldn’t look for a solution here or in the internet.

So, first i was looking for a solution on how to insert php code into my css file, i found this:

1) Name your .css file as .php file
2) At the top of the file specify the mime type as a text/css like this:

Code:
<?php
    $mtype = "text/css";
    header("Content-Type: $mtype");
?>

3) load your style.css file as style.php from your view and done !

It works like charms, but i have a little problem when i’am try to load a config variable into a css section, like this:

Code:
#form_container
{
background:#fff;

margin:0 auto;
text-align:left;
width:<?php echo $this->config->item('width');?>px;
}

Everything goes wrong and the style is not loaded at all.

Any ideas would help !

Sorry for my bad english.


Messages In This Thread
php config variable into css files - by El Forum - 06-29-2012, 02:16 PM
php config variable into css files - by El Forum - 06-29-2012, 02:32 PM
php config variable into css files - by El Forum - 06-29-2012, 02:34 PM
php config variable into css files - by El Forum - 06-29-2012, 02:40 PM
php config variable into css files - by El Forum - 06-29-2012, 02:46 PM
php config variable into css files - by El Forum - 06-29-2012, 04:08 PM
php config variable into css files - by El Forum - 06-29-2012, 04:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB