Linking to images within index.php
Posted: 01 December 2008 03:52 PM   [ Ignore ]  
Summer Student
Total Posts:  2
Joined  12-01-2008

Hi,

Sorry if this question has been covered before, I’m very new to Expression Engine :S

I’m currently writing my first template but having trouble linking to my images. I have an index.php file, stored in my physical folder under /public_html/sitedesign/site/index.php. I’d like to place my design graphic assets under publish_html/sitedesign/site/image/ but can’t seem to figure out how this is achieved.

I’ve tried {site_url}/sitedesign/site/image/ with no luck.

Any help very welcome.

Profile
 
 
Posted: 01 December 2008 04:04 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7061
Joined  04-15-2006

Hi Martin,

If your base site url is say :

http://www.example.com/sitedesign/site

that should then become your {site_url} variable so to get something that is physically located at :

http://www.example.com/sitedesign/site/image/

you should (well I’m pretty sure you should anyway) be able to get to it like this :

{site_url}/image/

or even easier just do this :

/image/

Shorter and sweeter. Does that work for you maybe?

Also just so that I totally understand what you have done if you view the image in your browser what do you have to type in to get to it? You said that you have an index.php file stored where you say you have but is that the main ExpressionEngine index.php file or something else?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 01 December 2008 04:20 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  2
Joined  12-01-2008

Wow thanks for the quick reply:)

Background:

I have set the .htaccess to hide index.php in the site URL, so the site’s URL reads domain.com.

I have set ‘Basepath to Template File Directory’ in ‘Global Template Preferences’ to place file at /home/sandshor/public_html/sitedesign.

The index template is located at /home/sandshor/public_html/sitedesign/site.

I’ve tried {site_url}sitedesign/site/images/logo.png, {site_url}/images/logo.png and /images/logo.png without any luck.

Entering the URL to the image manually within the browser also fails to display the image. Could the issue be related to an internal setting with the .htaccess file.

Content of .htaccess below;

RewriteEngine on
RewriteCond
$1 !^(images|cms|themes|index\.php|admin\.php) [NC]
RewriteRule
^(.*)$ /index.php/$1 [L]

Profile
 
 
Posted: 01 December 2008 04:26 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7061
Joined  04-15-2006

I’m not too good with .htaccess files unfortunately. I just use one of the methods from the WIKI and it usually works for me so I don’t think I will be much help there but if you can’t even access the image in a browser in the normal fashion then I would think that there is probably something up with the .htaccess file or something somewhere.

Perhaps try taking out the .htaccess file for now and see if you can then access the image in the normal way and then work up from there.

I’m sure other people around here will have some ideas on the .htaccess file though.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66388 Total Logged-in Users: 42
Total Topics: 84713 Total Anonymous Users: 18
Total Replies: 454686 Total Guests: 193
Total Posts: 539399    
Members ( View Memberlist )