Developer forum

Forum » Development » Does template tag exists?

Does template tag exists?


Reply

Hi guys...

 

when using Extenders it is a good procedure to check if that tag is in the current template so we do not put the server doing our "stuff" for a tag that it is not used.

 

my question is... how?

 

 

public class ExtraImages : Dynamicweb.eCommerce.Products.ProductTemplateExtender

{

  PageView pv = PageView.Current();

  String productID = this.Product.ID;

  String productName = this.Product.Name;

 

 

// ...

 

  if ( pv.get_value("myNewTag") != null )

  {

    // do this if the tag exists

  }

 

}

 

 

 

this does not work. Can anyone share his code on this part?

 

 

and by the way, other newbie question:

 

 

pv.SetMasterTemplateValues(); and pv.SetPageTemplatesValues();

 

what do they do, and do I need them?

 

how about

 

base.ExtendTemplate(Template);

 

do I still need this at the end?


Replies

 
Reply
bra@communikanten.dk wrote:

Hi guys...

 

when using Extenders it is a good procedure to check if that tag is in the current template so we do not put the server doing our "stuff" for a tag that it is not used.

 

my question is... how?

 

 

public class ExtraImages : Dynamicweb.eCommerce.Products.ProductTemplateExtender

{

  PageView pv = PageView.Current();

  String productID = this.Product.ID;

  String productName = this.Product.Name;

 

 

// ...

 

  if ( pv.get_value("myNewTag") != null )

  {

    // do this if the tag exists

  }

 

}

 

 

 

this does not work. Can anyone share his code on this part?

 

 

and by the way, other newbie question:

 

 

pv.SetMasterTemplateValues(); and pv.SetPageTemplatesValues();

 

what do they do, and do I need them?

 

how about

 

base.ExtendTemplate(Template);

 

do I still need this at the end?


1: In your Template Extender use the .TagExists("MyTagName") to check whether it's in use in the template.

 

2+3: These methods are invoked by Dynamicweb when setting template tags for master and page templates.

 

4: No, just leave it out.

 

You must be logged in to post in the forum