Developer forum

Forum » Templates » *.Contains(value) within search module

*.Contains(value) within search module

Martin Christensen
Reply

Hey, 

I want to use a conditional within the searchv1 module in the element template.

I would like to use this conditional:

<!--@If(DwSearchResultSummary.Contains(value))-->

 

I've done some testing:

This conditionals works:

<!--@If(DwSearchResultSummary == DwSearchResultSummary)-->

These don't work:

<!--@If(1 == 1)-->

<!--@If(DwSearchResultSummary.Contains(value))-->

Is there a way to make it work. I'm on DW 8.4.

BR

Martin


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Unless there's an tag extension method called Contains, your syntax is off. Contains looks like this:

TagName<contains>'Value to test'

http://devierkoeden.com/articles/dynamicwebs-best-kept-secrets-if-statements.aspx

Cheers,

Imar

Votes for this answer: 1
 
Martin Christensen
Reply

Hi Imar, 

you are ever so right. 

The strange part however is, that my syntax is grabbed from DW docs - http://templates.dynamicweb.com/TemplateTags/Dynamicweb-template-tags/General-tags/Tag-extensions.aspx

Thank you very much Imar.

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Ah, so there is an extension method called Contains. The docs say:

*.Contains(value) Returns True if tag value contains value.

so maybe you need to compae against 'True' or True?

 

You must be logged in to post in the forum