Developer forum

Forum » Templates » Checking in DwContent for specific template

Checking in DwContent for specific template

Daniel Williams
Reply

Hello

When i loop <!--@DwContent()--> out, I would like to check if a specific template exsists in the ParagraphContainer.
- The way i figured this, is If DwContent<contains>'specificTemplateClass.

I wan't to check if there is multiple of these templates in the container, is that possible?


Replies

 
Nicolai Høeg Pedersen
Reply

Well, you could make a new extension method that counts the number of string instances.

See examples here:

http://developer.dynamicweb-cms.com/forum/templates/where-can-i-find-all-the-new-dw8.2-tags.aspx

 

Then you can do something like If DwContent.CountString("specificTemplateClass")>1

 

Attached an example of an extension method.

 

OR

You wait for 8.2.3 which has Razor template support. And then you can do .NET code in the template....

 

BR Nicolai

 

You must be logged in to post in the forum