CSS not applying for controllers with 3+ URI segments in URL? |
[eluser]inktri[/eluser]
For example, I've got a controller called "user". Accessing: http://localhost/user/bob/three loads the page correctly HOWEVER the CSS doesn't apply I handle the user view page with a "master view". Code: $this->load->view('header', $data); CSS style sheet is declared in the header view and it's located in /var/www/css/ Code: <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" /> Anyone know why the CSS isn't applying?
[eluser]Popcorn[/eluser]
Use Code: <link rel="stylesheet" href="<?php echo base_url() ?>/style.css" type="text/css" media="screen" /> Instead. Make sure you have the URL helper loaded.
[eluser]compoundeye[/eluser]
i'm guessing because you used a relative path to your css file: ../css/style.css that when you start adding segments, http://localhost/user/bob/three it is interpreted as folders perhaps? so maybe its looking for http://localhost/user/bob/css/style.css instead of http://localhost/css/style.css? just a guess, if you really wanted to know you could create http://localhost/user/bob/css/style.css and http://localhost/user/css/style.css etc to see what effect it has cheers mat
[eluser]Colin Williams[/eluser]
It might help to study some of these basics before diving into actual development. |
Welcome Guest, Not a member yet? Register Sign In |