Developer forum

Forum » Templates » If Defined - related products

If Defined - related products

René Mehlsen
Reply
Hi

For my related products I have a heading that I don't want displayed if there is no related items for a given product. How should my "IF" look.

I have tried the following without success.

<!--@If Defined(ProductRelatedGroups)-->

<h2>Related Products</h2>
<ul>
  <!--@LoopStart(ProductRelatedGroups)-->
     <!--@LoopStart(RelatedProducts)-->
     <li>
         <a href="<!--@Ecom:Product.Link.Clean-->"><!--@Ecom:Product.Name--></a>
     </li>
     <!--@LoopEnd(RelatedProducts)-->
  <!--@LoopEnd(ProductRelatedGroups)-->
</ul>

<!--@EndIf(ProductRelatedGroups)-->

Replies

 
Nuno Aguiar
Reply
Hi René,

Use Header and Footer to achive this, envolving all of the <h2> and <ul> in it

For more information check out
http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Loops.aspx

Nuno

 

You must be logged in to post in the forum