Developer forum

Forum » Ecommerce - Standard features » Image Tag Edit

Image Tag Edit

Aditya Bante
Reply

  Hi I have this code 
  @foreach (LoopItem i in GetLoop("Products"))
   {
         @i.GetValue("Ecom:Product.ImageSmall")     
   }

  which renders this on frontend

  
  <img src="/Files/Billeder/sponsor%20logoer/logo/AlinaFirmareng%c3%b8ring.jpg" border="0" alt="" width="220" height="120" class="EcomImageSmall">
   
   as you can see the source for the image path is not wrapped in <img /> tag in the code, but it renders it on front page. I would like to add additional class on that <img/>
   tag and change it's src="" attribute to data-src="" instead. in order to implement lazy load on images. 
   
   so my question is where can I edit the <img/> as it only appers on frontend but not in the loop " @i.GetValue("Ecom:Product.ImageSmall")" ? 
   
   any suggestions? 
   
   Thanks 
   Best Regards
   Aditya Bante


Replies

 
Thomas Schroll
Reply
This post has been marked as an answer

Hi Aitya

You can use Ecom:Product.ImageSmall.Clean and wrap it in your custom img tag. You can see all dw tags available here: http://doc.dynamicweb-cms.com/Default.aspx?ID=1056 or you can write @TemplateTags() (razor) or <!--@TemplateTags--> (html) in your template, and the tags will be visible frontend.

Regards Thomas

Votes for this answer: 1
 
Aditya Bante
Reply

Thanks, it works. cheers :) 

 

You must be logged in to post in the forum