Page 1 of 1

codeigniter

Posted: Wed Feb 05, 2014 1:49 am
by ansontp
I am using codeigniter framework in my website. When i access header file from view in the index function of controller it works fine :) but when i call header file in another function inside a controller css and images are not working.. Please help me..:(

Re: codeigniter

Posted: Wed Feb 05, 2014 2:11 am
by requinix
Make sure your CSS and image and Javascript paths are absolute: with a leading slash. Otherwise they're relative to the "current directory" in the URL. Like

Code: Select all

<link rel="stylesheet" type="text/css" href="/path/to/file.css">

Re: codeigniter

Posted: Wed Feb 05, 2014 2:50 am
by ansontp
I am giving my css link like this..
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/myfile.css')?>">

But this is working in index function.. but not working in other functions

Re: codeigniter

Posted: Wed Feb 05, 2014 5:49 am
by Celauran
How is it not working? Is it generating an error message? Generating the wrong path? Nothing at all?