Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Passing parameters into Custom Macros View modes: 
User avatar
Member
Member
lancetek - 9/14/2011 9:57:12 AM
   
Passing parameters into Custom Macros
I'm trying to figure out how to pass dynamic parameters into a Custom Macro. Here's what I'd like to do:


{#mycustommacro(cmscontext.currentdocument.documenttags)#}


Now, this obviously doesn't work, but I hope you understand what I am trying to do; is there a way to accomplish this using Kentico macros?

I've read: hardcoded custom macros, macro fun and Awesome new macroness by Martin, but I don't see how to accomplish this task...

Thanks,
Lance

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 9/14/2011 5:52:37 PM
   
RE:Passing parameters into Custom Macros
Hello,

You don't have to use this approach. You can simply get the data you need directly in the custom macro. The entire document context is available during the macro resolution, so for example you can get the document tags the following way:

string tags= CMS.CMSHelper.CMSContext.CurrentDocument.DocumentTags;

Best regards,
Boris Pocatko