Web Hosting Talk







View Full Version : javascript or style css call absolute url for image search


andreaf
07-25-2006, 04:41 AM
Hi there,
i don't know it it's possible but here is what I'm trying to do since the 15th of July.

I've a software that has multiple templates based on language.

Each template can be modified to reflect some changes due to the language.

I'm in the process to replace text fields choice with images (air-conditioning with air-conditioning.gif) so to show all fields in many language without the need of replicating them.

Es:
www.mydomain.com/english/images/air-conditioning.gif
www.mydomain.com/espanol/images/air-conditioning.gif
www.mydomain.com/francais/images/air-conditioning.gif

The problem is that each domain language section is not in this way:
www.mydomain.com/english/
www.mydomain.com/espanol/
www.mydomain.com/francais/

but always
www.mydomain.com (it works with cookies/sessions id)

The image air-conditioning.gif is always shown as:

www.mydomain.com/air-conditioning.gif no matter the language we're seeing the website.

ALL I NEED SHOULD BE A COMMAND TO INSERT IN ANY TEMPLATE TO MAKE IT LOAD ALL THE IMAGES, OR AT LEAST THE IMAGES NEEDED TO SHOW IN DIFFERENT LANGUAGES, COMING FROM A GIVEN DIRECTORY:

www.mydomain.com/english/images/ (for the english template)
www.mydomain.com/espanol/images/ (for the english template)
www.mydomain.com/francais/images/ (for the english template)

THIS SHOULD BE A CSS OR JAVASCRIPT COMMAND AND NOT PHP AS IT DOESN'T WORK WITHIN THE PHP THAT GENERATES THE IMAGE FROM TEXT.

IS THERE ANYWAY TO ACHIEVE THIS?

I'm lost...

Andrea

Devin-VST
07-25-2006, 08:43 AM
if you want to load all the images from a different directory (I think that's what you are saying) you could try putting

<base href="http://yourdomain.com/lang/english">

in your <head> section.

So in your page, if you said
<img src="file.gif">
It would be interpreted
<img src="/lang/english/file.gif">

maybe that will work?

andreaf
07-25-2006, 09:34 AM
Devin,
it worked like a charm!

Thanks

Andrea

Devin-VST
07-25-2006, 03:34 PM
great :D just watch out for your hyperlinks, because they will act the same way if they are not absolute

andreaf
07-26-2006, 02:46 AM
great :D just watch out for your hyperlinks, because they will act the same way if they are not absolute

You bet!

Thanks again!