Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

relative urls

Status
Not open for further replies.

toptomato

Programmer
Jul 22, 2005
62
US
hi,
on my development machine the url to the common images is following:

I have two pages:
&

both of the above pages have a image element who's CSS class is 'ProductImage':
.ProductImage
{
background-image: url(CommonImages/NoPicture.gif);
}

---
However, the above doesn't work. since CommonImages/NoPicture.gif is evaluated differently for different pages. I don't want to specifiy the full path like '/Prototype/StoreFront/CommonImages/NoPicture.gif' since this part (/Prototype/StoreFront) will be different for differnt clients. Any way to get this accomplished.

In ASP.net my application resides under and under asp.net i can simply say "~/CommonImages/NoPicture.gif" regardless of the directory i am at and it evaluates it to:
'/Prototype/StoreFront/CommonImages/NoPicture.gif'
Is there such an alternative to '~' of ASP.net in html or javascript. May be a combination of "./../" something...
 
How about aliasing your commonimages folder so you can refer to the alias rather than actual path? Then it should work for all clients?

At my age I still learn something new every day, but I forget two others.
 
Or put the full path in a variable in a separate file which gets included in each page? Change once, clear cache, and you've got a different path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top