Developer forum

Forum » CMS - Standard features » image tag autoappending src

image tag autoappending src

Jonas Mersholm
Reply

Hi DW forum.

I am trying to make a dynamic logo pr. website, using items. The item works fine, and getting the item in the frontend works fine. The problem is, that when i do the following

<img src='@GetString("Item.Area.Logo")' />

The result is

<img src="/Files/Templates/Designs/Site//Files/Billeder/logo_n2_hvid_CMYK.png">

The Image tag automatically appends /Files/Templates/Designs/Site/ to the src. How do i stop this behaviour?

 

Jonas


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

Currently, you can only work around this using this nasty hack (assuming the value of Item.Area.Logo url is an absolute url)

<img src='/../@GetString("Item.Area.Logo")' />

This makes the layout parser leave the attribute value alone (since it looks like an absolute url).

Not that this is only an issue in layout template (page templates). I have created a product backlog item for this as we need a better solution.

Best regards,
Mikkel

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Or you can call Replace on the return value of GetString and get rid of the unwanted part of the path. That could break when you rename the design though....

 

Imar

 
Jonas Mersholm
Reply

Thank you for the fix Mikkel :)

 

You must be logged in to post in the forum