Part of the EllisLab Network
   
 
Where does the main content go?
Posted: 10 May 2008 03:08 PM   [ Ignore ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

I’ve been spending a while looking for where the main content goes like images, stylesheets, etc. I can’t find where it would go. I tried putting it in the root directory and was unsuccessful. Any help would be appreciated thanks!

Profile
 
 
Posted: 10 May 2008 03:54 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  3097
Joined  01-07-2008

Your static content can go anywhere on your server.  Most people create an asset folder in their ci-root.  Remember that your paths will be relative to index.php.

Also, if you’re using .htaccess make sure to exclude the asset folder.

 Signature 
Profile
MSG
 
 
Posted: 10 May 2008 04:12 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

Well that’s what i’ve been trying so lets say i’m going to use images on a page(view) so I would set the paths to images/whatever.jpg. inside the root folder where index.php is I have the images folder and the <whatever.jpg> inside. it’s not working when I tried that.

Profile
 
 
Posted: 10 May 2008 06:18 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  3097
Joined  01-07-2008

Hmm, following scenario:

CI-Root:
www.example.com/myci/index.php

Image
www.example.com/myci/images/test.png

CI View
img src=”/myci/images/test.png”
or
img src=”./images/text.png”

 Signature 
Profile
MSG
 
 
Posted: 10 May 2008 08:21 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

I tried both of those but was unsuccessful with both…

Profile
 
 
Posted: 10 May 2008 08:44 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  3097
Joined  01-07-2008

Are you using a .htaccess file?  If so, could you post the contents?

 Signature 
Profile
MSG
 
 
Posted: 10 May 2008 09:16 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

No I am not using one, also when I call which directory everything is in it says it’s in the CI folder, which is right where it should be… Also I used an absolute URL and it didn’t display any images, it’s just not displaying images in total.

Profile
 
 
Posted: 10 May 2008 09:37 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

<deleted>

Profile
 
 
Posted: 11 May 2008 12:41 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

Alright I checked if I was getting any errors, all the logs say that are important and have anything to do with an error is: ERROR - 2008-05-11 11:39:07—> 404 Page Not Found—>  I don’t know why it’s saying page not found because the page works, I know for a fact the images work as well, it reads the images, I tried using a URL directly to it(www.google.com/whateverhtegoogleimageis.jpg) and that worked perfectly, but using it from the local folder doesn’t work at ALL.

Profile
 
 
Posted: 11 May 2008 01:20 PM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  3097
Joined  01-07-2008

This doesn’t sound like a CodeIgniter issue.  Image requests aren’t routed through CI, they’re just done normally.  Can you access an image if you just place it in your server root?

 Signature 
Profile
MSG
 
 
Posted: 11 May 2008 01:35 PM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

no I can’t, in fact I can’t access anything through CI using the local routes(/home/username/public_html/whatever.jpg) I know for a fact it finds it because when I checked my error logs and put a image that didn’t exist it gave me an error that it couldn’t find it, however when I used a picture that existed it found it but didn’t load it. I was successful making all my links like this: “<?php echo $baseth;?>images/home.jpg” $baseth is the direct URL to the CI folder.

Profile
 
 
Posted: 12 May 2008 10:55 PM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  8
Joined  05-10-2008

Okay, after checking some more it looks like the problem is because it reads the links like this CI/index.php/images/whatever.jpg It shouldn’t be index.php :\.

Profile
 
 
Posted: 12 May 2008 11:32 PM   [ Ignore ]   [ # 12 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  3097
Joined  01-07-2008

Try using base_url from the url helper.

<?base_url(); ?>images/whatever.jpg 

Before doing that make sure that $config[‘base_url’] in config/config.php is set correctly.

 Signature 
Profile
MSG