![]() |
Dynamic CSS - Common approach for code-igniter? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Dynamic CSS - Common approach for code-igniter? (/showthread.php?tid=10471) |
Dynamic CSS - Common approach for code-igniter? - El Forum - 08-01-2008 [eluser]sl3dg3hamm3r[/eluser] Hey there Here comes right my second question :-) Additional data like css and images I do store now on the same level as where you would find the system-folder. But now I encounter the situation where I would like to manipulate some variables in css, before it is sent to the browser. E.g. if there is a background-picture defined which is language-depending, I need to set that picture first with code-igniter. What is there the approach? Shall I treat in that case CSS as a view? Or what are the common approaches here in that case? Any tipps highly appreciated! ![]() Oliver Dynamic CSS - Common approach for code-igniter? - El Forum - 08-01-2008 [eluser]Hannes Nevalainen[/eluser] I have a css-controller thats is outputing a css-file which I'm including in my main view. You can easily pass data as uri segments or pull data from your database. Code: <link rel="stylesheet" type="text/css" href="<?=site_url('css')?>" /> Enable caching if your css controller while not developing, then the overhead added by having php to output your css is reduced. Happy Coding! //Hannes Dynamic CSS - Common approach for code-igniter? - El Forum - 08-02-2008 [eluser]Mirage[/eluser] You certainly can just make your CSS file a view and inject PHP that way. I'd say it all depends on what and how much you want to make dynamic. An alternate approach might be to override default/static css rules by injecting them into a page header or inline. For the language example I usually define css for each language - overriding rules in the default css and inject which language to load right into the page header: Code: <link rel="stylesheet" type="text/css" href="/css/default.css"> HTH, m Dynamic CSS - Common approach for code-igniter? - El Forum - 08-02-2008 [eluser]sl3dg3hamm3r[/eluser] thank you for the inputs - I gonna try out some more as soon as I'm back from holydays :-) happy coding! |