5

sorry to bother but I am having some confusion with filepaths within codeigniter, as you may or may not know CI lays out its file system as follows:

-application: -controllers -views -models -system(contains CI framework) 

I have created a css file and have some images saved in the a resources folder like so:

 -application: -controllers -views -models -system(contains CI framework) -resources -img001 -style.css 

I was wondering whether someone could point me in the right direction to accessing the resources folder using relative paths.

2 Answers 2

6
echo FCPATH."resources/img001/img_name.jpg"; echo FCPATH."resources/style.css"; 

Constant FCPATH will return system's path to Your front controller's file (index.php at root of Your CI-App)

Sign up to request clarification or add additional context in comments.

Comments

4

You can use base_url function. To use this function you have to load url helper

You can load wherever it required as below:

$this->load->helper('url'); 

Or you can set in autoload.php.

echo base_url("resources/img001/img_name.jpg"); echo base_url("resources/style.css"); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.