Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > QueryString If Exists View modes: 
User avatar
Member
Member
DahlinDev - 2/15/2013 10:38:49 AM
   
QueryString If Exists
I am using the Breadcrumbs webpart.

The client wants on the Search results page to display the "searchtext" querystring in the breadcrumbs.

I am able to add the querystring to the end using the Html Envelope : Content After with with {% QueryString["searchtext"] %}

However I can't simply append the text, I need to wrap this in some html for styling purposes. And, I can only add the html if the querystring exists.

So I am looking for a macro express that checks if the querystring exists and if it does return "[html]{%querystring%}[more html]"


User avatar
Kentico Support
Kentico Support
Accepted solutionAccepted solution
kentico_janh - 2/15/2013 2:15:42 PM
   
RE:QueryString If Exists
Hello,

You can simply write a bit complexer macro like:
{%
if (QueryString.GetValue("searchtext") != null) {
return "<h1>QueryString.GetValue("searchtext")</h1>"
}
%}

Best regards,
Jan Hermann

User avatar
Member
Member
DahlinDev - 2/15/2013 2:23:45 PM
   
RE:QueryString If Exists
Thanks!

User avatar
Member
Member
mvcftw-gmail - 6/10/2013 4:16:06 PM
   
RE:QueryString If Exists
Is this safe to from injection as is, or does it require more to display?

User avatar
Kentico Support
Kentico Support
kentico_janh - 6/11/2013 2:52:17 AM
   
RE:QueryString If Exists
Hello,

Yes, returned string is already escaped.

Best regards,
Jan Hermann