Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Macros syntax for testing empty string View modes: 
User avatar
Member
Member
Powlin - 2/13/2013 1:28:33 PM
   
Macros syntax for testing empty string
Hello,

I'm trying to write a macro that build an URL. It verify if the querystring "callid" contains a value then append "&callid=value" to my URL else don't add anything

This is what I'm using right now but it doesn't work :

{%?callid?|(notequals)|(truevalue)&callid={?callid?}|(falsevalue)%}

I'm unable to find the right syntax for testing an empty string in a macro,

Could you help me.

Thanks

User avatar
Member
Member
kentico_davidb2 - 2/19/2013 6:49:44 AM
   
RE:Macros syntax for testing empty string
Hello,

by your requested result, I would suggest using:

{%if (callid != "empty") { "&callid=" } else { "" }|(default)empty%}{%callid%}

Please note that macro support is not the same across all 5.x versions.

I would also recommend upgrading to current version of Kentico CMS 7 as there is much richer macro support including custom K# syntax.

David