codeigniter

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
ansontp
Forum Newbie
Posts: 2
Joined: Wed Feb 05, 2014 1:45 am

codeigniter

Post 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..:(
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: codeigniter

Post 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">
ansontp
Forum Newbie
Posts: 2
Joined: Wed Feb 05, 2014 1:45 am

Re: codeigniter

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: codeigniter

Post by Celauran »

How is it not working? Is it generating an error message? Generating the wrong path? Nothing at all?
Post Reply