Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Macro gets destroyed by editable region View modes: 
User avatar
Member
Member
dfurler-liv.asn - 11/29/2012 11:07:31 PM
   
Macro gets destroyed by editable region
Hello,

I need to have a macro in an editable text region that changes a URL based on whether a visitor is internal or external. I have something like the below working fine:

<a href="{% internal = "192.168"; if (internal == Substring(IP, 0, 7)) {"http://someinternallink"} else {"http://someexternallink"} %}" target="blank">

I paste the above in as source and it works when saved, however, no one is able to edit that page again because the CMS converts the quotes to html entity on the next edit and in doing so destroys the macro.

I have tried lots of combinations of single and double quotes to try to get around this but nothing seems to work.

Does anyone know how I can paste a macro into an editable text area and have it stay untouched. The particular text area does not have a "insert macro" button in the tool bar as I have come across in certain tutorials.

Thanks,
David

User avatar
Kentico Support
Kentico Support
kentico_janh - 11/30/2012 2:49:41 AM
   
RE:Macro gets destroyed by editable region
Hello,

There is probably a problem in combination of quotes and apostrophes. Please use following macro instead:

<a href='{% internal = "192.168"; if (internal == Substring(IP, 0, 7)) {return "http://someinternallink"} else {return "http://someexternallink"} %}' target="blank">


Best regards,
Jan Hermann

User avatar
Member
Member
dfurler-liv.asn - 12/9/2012 11:22:46 PM
   
RE:Macro gets destroyed by editable region
Sorry for the delay in responding, your reply seems to have got lost in my spam filter.

This didn't work for me sadly.

Regards,
David

User avatar
Member
Member
dfurler-liv.asn - 12/9/2012 11:28:51 PM
   
RE:Macro gets destroyed by editable region
Oops, my mistake. I was seeing the encoded quote characters when I went from source to wysiwyg and thinking your version was still breaking, but it is returning the correct html after all.

Thanks Jan,
David