Welcome Guest, Not a member yet? Register   Sign In
Dynamic Css
#7

[eluser]vile[/eluser]
[quote author="CI Coder" date="1259123157"]First of all I think you have "/css/default.php" outside of CI's directory structure. If that's the case you cannot do what you want. What you want to do is done by making the stylesheet a CI view and passing all the data to it as normal. So, if you want to try it here it is:

Make a view: stylesheet.php that contains this: (just like a css file)

Code:
body
{
    background-color: <?php echo $bgcolor;?>;
}
in the view of your page
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Theme&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;theme"&gt;
&lt;/head&gt;
&lt;body&gt;
TEsting
  
&lt;/body&gt;
&lt;/html&gt;
then in your Theme::index() function do this:
Code:
function index()
    {
        $data['bgcolor'] = "#ff0000";  
        $styles = $this->load->view('stylesheet',$data, TRUE);
        header('Content-type: text/css');
        echo $styles;
    }

It's a good idea to do it this way. It'll give you a lot of options later in the design.

Good luck.[/quote]

Thanks! it worked. Big Grin
i used &lt;style&gt;&lt;/style> instead of header().


Messages In This Thread
Dynamic Css - by El Forum - 11-23-2009, 08:17 PM
Dynamic Css - by El Forum - 11-23-2009, 08:33 PM
Dynamic Css - by El Forum - 11-23-2009, 08:43 PM
Dynamic Css - by El Forum - 11-24-2009, 02:15 AM
Dynamic Css - by El Forum - 11-24-2009, 10:26 AM
Dynamic Css - by El Forum - 11-24-2009, 04:25 PM
Dynamic Css - by El Forum - 11-24-2009, 09:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB