Multi part conditional statement with Contains

Ron Rainey asked on October 16, 2019 23:01

Hi all, I've got webpart visibility set on a macro like so: {% Contains(CurrentDocument.AbsoluteURL, "/Real-Estate/") #%}

Works like a champ. But I want to add a second Contains condition and this seems like it should be very simple but the syntax is eluding me. I've tried If/Else statements returning True/False, I've tried some || operators. I tried a few other methods I felt should work, but I'm stumped.

So how would I check for a URL containing either of 2 strings?

Recent Answers

Peter Mogilnitski answered on October 17, 2019 03:55 (last edited on October 17, 2019 16:22)

you syntax is correct:

{% Contains("aaa bbb", "ccc") || Contains("aaa bbb", "bbb")@%}


{%CurrentDocument.AbsoluteUrl.Contains("/admin/") || CurrentDocument.AbsoluteUrl.Contains("localhost")@%}

0 votesVote for this answer Mark as a Correct answer

LarianBretto LarianBretto answered on October 18, 2019 12:50

So, I've just started using Kentico at my internship, and I have been working on an audit for an old site of my company's. One of the tasks I've been given is to shorten the control ID's for each web part. An alternative I've started poking around at is to change the ClientIDMode property to static. Now, I can do this in the web.config, but i've been warned that this could cause problems with the Kentico admin interface. I should also be able to set this property using a web part, so it works on a page by page basis. Has anyone tried something like this before, and if so, any pointers as to how to go about implementing this?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.