Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Webpart html envelope - content before/after - inline code View modes: 
User avatar
Member
Member
Peter - 6/20/2011 1:43:36 AM
   
Webpart html envelope - content before/after - inline code
Hi,
I was wondering if possible to call inline code within the html envelope content before of a webpart.

somethin like ...


<% if (CMSContext.CurrentUser.IsInRole("CMSEditor", CMSContext.CurrentSiteName)) { %>
<p>
bla bla bla.... only visible for editors...bla bla bla
</p>
<% } %>


the problem with this is that the "<%" tags get converted to "<%" so the code doesnt work but is just displayed.

Thanks for any suggestions.

Peter

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/20/2011 9:12:16 AM
   
RE:Webpart html envelope - content before/after - inline code
Hi,

you could create a custom macro that would check if user is in role or not and returns string values "true" or "false".

Then you could create a container that would be used only in case your custom macro returns true, i.e. in case the user is in role. Therefore you could insert following macro to the Web part container property. Black.box is a code name of container.

{#mycustommacroname|(tobool)true|(truevalue)Black.Box|(falsevalue)""#}

Best regards,
Ivana Tomanickova