Dynamic Css |
[eluser]vile[/eluser]
Hi, Im working on dynamic. How can i pass data to css? here's my code: controller: Code: class Theme extends Controller { view Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> css Code: <?php i cant get the value of bgcolor in default.php ![]()
[eluser]jedd[/eluser]
Do you really need to faff with the in situ style sheet, or are you just trying to have multiple style sheets - selecting them based on current theme, say? I do the latter - and in my main view file I have this code: Code: echo "\n". link_tag('assets/stylesheets/COMMON.css'); Remember the C in CSS stands for cascading.
[eluser]vile[/eluser]
ummm what im trying to do is to get style from the database.. i have default template. but i want to make it dynamic. customizable ![]()
[eluser]Jamie Rumbelow[/eluser]
Then make a Stylesheets controller with various methods for the different stylesheets. Put the CSS in a view along with your PHP and remember to put Code: $this->output->set_header('Content-type: text/css'); In your controller somewhere. Then just link to it how you would any other action! You've got full access to the CI masterobject and PHP within your CSS stylesheets, and it doesn't require any nasty hacks. Jamie
[eluser]Unknown[/eluser]
Has anyone looked into integrating CSScaffold into codeigniter? http://wiki.github.com/anthonyshort/csscaffold If I get some time one day i'll give it a shot myself...
[eluser]CI Coder[/eluser]
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 Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> Code: function index() It's a good idea to do it this way. It'll give you a lot of options later in the design. Good luck.
[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 Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> Code: function index() 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. ![]() i used <style></style> instead of header(). |
Welcome Guest, Not a member yet? Register Sign In |