CodeIgniter Forums
Cannot find my folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Cannot find my folder (/showthread.php?tid=29060)



Cannot find my folder - El Forum - 03-29-2010

[eluser]johnnyForums[/eluser]
Hi, I have the stock installation and added an assets folder so that my structure is:

CodeIgniter_1.7.2
-system
--application
---assets <-missing folder reference
---config
---controllers
---...all the rest

In my code I have:

Code:
&lt;?php echo site_url(); ?&gt;<br />
&lt;?php echo base_url(); ?&gt;<br />
<img src="&lt;?= site_url('assets/images/960_12_10_10.png');?&gt;" alt="My Image" />

I get the site and base url returned but I can never load my image nor any css files.

I cannot manually browse to them either with:

http://myserver/index.php/assets/images/960_12_10_10.png

The files are there. All is spelled and cased correctly, I just can't get the files to show.

In config.php I have:

Code:
$config['base_url']    = "http://myserver/";

My webpages come up fine, just not my stuff in the new assets folder.

What am I missing since I added to my project the assets folder?

Thank you.

EDIT: fwiw, I have hacked the URL lots and moved the assets folder all over the place.

What I found was that I can only see the items if I put my assets folder like this:

CodeIgniter_1.7.2
-assets
-system
--application

What did I do wrong if I want it under application?


Cannot find my folder - El Forum - 03-29-2010

[eluser]2think[/eluser]
Since you cannot manually browse to them, it could be something to do with your .htaccess file. Post that in here if you can.


Cannot find my folder - El Forum - 03-29-2010

[eluser]johnnyForums[/eluser]
EDIT: fwiw, I have hacked the URL lots and moved the assets folder all over the place.

What I found was that I can only see the items if I put my assets folder like this:

CodeIgniter_1.7.2
-assets
-system
—application

What did I do wrong if I want it under application?


Cannot find my folder - El Forum - 03-30-2010

[eluser]InsiteFX[/eluser]
Try this:

Code:
WRONG!
<img src="&lt;?= site_url('assets/images/960_12_10_10.png');?&gt;" alt="My Image" />

<img src="&lt;?php echo base_url();?&gt;assets/images/960_12_10_10.png" alt="My Image" />
or
<img src="&lt;?php echo site_url('assets/images/');?&gt;960_12_10_10.png" alt="My Image" />

Enjoy
InsiteFX


Cannot find my folder - El Forum - 03-30-2010

[eluser]Azafar[/eluser]
base_url() is used while displaying images rather than site_url(). There is a big difference in base_url() and site_url(). one of them is base_url does not include index.php while site_url does include it. then think how an image can be loaded if the path will be like this http://myserver/index.php/assets/images/960_12_10_10.png . Smile