![]() |
|
|
#11 |
|
Guest
Posts: n/a
|
Master pages, images and subdirectories
Hi, I've had a similar problem so need to confirm the solutions
Firstly I don't want to use asp image server controls but keep html where possible If I use <img src="/images/pic.jpg" /> then this would works for all subdirectories but doesn't work in design view of Expression Web 2.0 if the master is not in the root. Is there a way to resolve this? Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET coontrols, is that correct? Using relative paths such as <img src="../images/pic.jpg" /> doesn't work as the page is not updated from the master tia, Chris |
|
|
|
#12 |
|
Guest
Posts: n/a
|
Re: Master pages, images and subdirectories
Chris Smith wrote:
> If I use <img src="/images/pic.jpg" /> then this would works for > all subdirectories but doesn't work in design view of Expression > Web 2.0 if the master is not in the root. xWeb does not support root-relative paths such as "/foo" or "/foo/bar". You should avoid using them. > Using ~ such as <img src="~/images/pic.jpg" /> only works in > ASP.NET coontrols, is that correct? Yes. But you just need to add runat="server" to your "img" element. > Using relative paths such as <img src="../images/pic.jpg" /> > doesn't work as the page is not updated from the master Yes, there is no URL rewriting in Master Pages. Dynamic Web Templates work better in this aspect. -- <http://schneegans.de/sv/> · XML Schema Validator |
|
|
|
#13 |
|
Guest
Posts: n/a
|
Re: Master pages, images and subdirectories
If you are going to use ASP.NET, I would go ahead and bite the bullet and
use the <asp:Image> control, so you can use the tilde (~) to represent root. I understand trying to keep things as HTML, but the overhead of adding a few controls is negligible unless your site is a google. And, if your site is a google, you have the money to solve this success problem. To render an image from a control wastes a few microseconds at best compared to standard html. The time to request and download the image far outweighs the cost, in cycles. In addition, the network latency will offset the cost of all other portions combined. As long as you are not using thousands, perhaps millions, of images on a master page (unlikely), I would not sweat this one. -- Gregory A. Beamer MVP, MCP: +I, SE, SD, DBA Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss or just read it: http://gregorybeamer.spaces.live.com/ ******************************************** | Think outside the box! | ******************************************** "Chris Smith" wrote in message news:200862034835csmith@oilspilltraining.com... > Hi, I've had a similar problem so need to confirm the solutions > > Firstly I don't want to use asp image server controls but keep html where > possible > > If I use <img src="/images/pic.jpg" /> then this would works for all > subdirectories but doesn't work in design view of Expression Web 2.0 if > the master is not in the root. Is there a way to resolve this? > > Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET > coontrols, is that correct? > > Using relative paths such as <img src="../images/pic.jpg" /> doesn't work > as the page is not updated from the master > > tia, Chris |
|
|
|
#14 |
|
Guest
Posts: n/a
|
Re: Master pages, images and subdirectories
INLINE
"Christoph Schneegans" <Christoph@Schneegans.de> wrote in message news:6c1c5lF3dul5iU1@mid.individual.net... > Chris Smith wrote: > >> Using ~ such as <img src="~/images/pic.jpg" /> only works in >> ASP.NET coontrols, is that correct? > > Yes. But you just need to add runat="server" to your "img" element. As long as it is understood that simply adding runat=server to an HTML control does not add the relative url mapping. The routine to find the server path for root is not included in the html controls. >> Using relative paths such as <img src="../images/pic.jpg" /> >> doesn't work as the page is not updated from the master > > Yes, there is no URL rewriting in Master Pages. Dynamic Web > Templates work better in this aspect. The con with DWTs is they do get out of sync and fail to update pages. If the page is not updated, you end up with the old look. -- Gregory A. Beamer MVP, MCP: +I, SE, SD, DBA Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss or just read it: http://gregorybeamer.spaces.live.com/ ******************************************** | Think outside the box! | ******************************************** |
|
|
|
#15 |
|
Guest
Posts: n/a
|
Re: Master pages, images and subdirectories
Chris, add the runat="server" attribute to the image tag and this will turn
it into an HtmlImage control. The src="~/images/pic.jpg" format is what you want. Give it a quick try and it should work. Hope this helps, Mark Fitzpatrick Microsoft MVP - Expression "Chris Smith" wrote in message news:200862034835csmith@oilspilltraining.com... > Hi, I've had a similar problem so need to confirm the solutions > > Firstly I don't want to use asp image server controls but keep html where > possible > > If I use <img src="/images/pic.jpg" /> then this would works for all > subdirectories but doesn't work in design view of Expression Web 2.0 if > the master is not in the root. Is there a way to resolve this? > > Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET > coontrols, is that correct? > > Using relative paths such as <img src="../images/pic.jpg" /> doesn't work > as the page is not updated from the master > > tia, Chris |
|
|
|
#16 |
|
Guest
Posts: n/a
|
Re: Master pages, images and subdirectories
"Cowboy (Gregory A. Beamer)" wrote:
> As long as it is understood that simply adding runat=server to an HTML > control does not add the relative url mapping. The routine to find the > server path for root is not included in the html controls. <img src="~/foo/bar.jpg" runat="server" /> works for me. The "src" attribute gets properly resolved e.g. to "../foo/bar.jpg" by ASP.NET. -- <http://schneegans.de/sv/> · XML Schema Validator |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|