Welcome Guest, Not a member yet? Register   Sign In
Dynamic CSS: getting data into the file (again)
#1

[eluser]codex[/eluser]
You can put php in a css file by adding header('text/css'), and that all works fine. But I'd like to add <?php base_url()?> (and get data from a db) to the file, but this isn't available in a regular php file. How do you extend the file so that the ci instance is available?

I already asked this question some time ago, but haven't been able to find a solution yet. Here's the original post: http://ellislab.com/forums/viewthread/77954/
#2

[eluser]Nick Husher[/eluser]
Could you not have a controller called "css.php" that uses the output class to set Content-type: text/css, then load a view with CSS in it? That would give you access to PHP and CodeIgniter properties.
#3

[eluser]codex[/eluser]
[quote author="Nick Husher" date="1220430626"]Could you not have a controller called "css.php" that uses the output class to set Content-type: text/css, then load a view with CSS in it? That would give you access to PHP and CodeIgniter properties.[/quote]

Yes, that's exactly what I did just now :-)




Theme © iAndrew 2016 - Forum software by © MyBB