gjshah7254
5/9/2014 - 5:00 AM

Macros inside Transformation

Macros inside Transformation

Get value from Querystring & compare
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{?VenueName?}|(equals)test|(truevalue)Yes|(falsevalue)No") %>

Get Parent page properties
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%Documents[\"" + Eval("NodeAliasPath")+ "\"].Parent.DocumentName @%}") %> - if this doesn’t work enable debugging and check security for the macro, only happens when you are trying to get parent page properties.

check if user is logged in or not
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%currentuser.userid|(equals)65|(truevalue)Anonymous|(falsevalue)Registered#%}") %>

Get page titles, metadata, keyword information for pages
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%Documents[\"" + Eval("NodeAliasPath")+ "\"].DocumentPageTitle @%}") %>

Get Textbox information from the page tab
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%Documents[\"" + Eval("NodeAliasPath")+ "\"].WebpartIDName @%}") %>

Get Data from the settings of CMS
CMS.SettingsProvider.SettingsKeyProvider.GetStringValue("CMSPageTitlePrefix")

Resolve a macro in kentico 7 transformation
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%Macro Goes here%}") %>