Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
how to access images with includes?
Old 01-01-2006, 01:11 PM how to access images with includes?
Ultra Talker

Posts: 358
Location: Devon, UK
Trades: 4
Hi,

I have some include files which are located in a dir;

public_html/folder1

These files are accessed from folder1 and folder2, which is located;

public_html/folder1/folder2

Now, I need to access images which are located in folder1/images from these inlude files.

But, I cannot use the absolute url (eg http://www.mysite.com/folder1/images/imagename.gif) because some pages need to access these includes through https meaning that I get some 'insecure messages'.

If I use the relative url, eg img src="images/imagename.gif" it works fine in the folder1 dir but not in the folder2 dir.

Is there any way i can use relative urls which will work in both folder1 and folder2, or is there another way of including the files which would access the images from the location of the include file and not the location of the file the include is included in. If you understand me!

Thanks for your help
Simon
recedo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-01-2006, 01:36 PM
Novice Talker

Posts: 10
Trades: 0
images would have to be included using ../images/imagename.gif or whatever it is.

This is a bit difficult and i have only done it once.
allhostz is offline
Reply With Quote
View Public Profile
 
Old 01-01-2006, 01:42 PM
Ultra Talker

Posts: 358
Location: Devon, UK
Trades: 4
Yes, this would work for the files in folder2 but then the files in folder1 would not show the images correctly!

I would setup a variable for the root, however the actual include files cannot have php code in them as they are also included in an application that cannot read any php!

Simon
recedo is offline
Reply With Quote
View Public Profile
 
Old 01-01-2006, 03:25 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use relative references from the site root
src="/images/folder1/imagename"
or
src="/images/folder1/folder2/imagename.gif"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to how to access images with includes?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29876 seconds with 12 queries