Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > ResolveCustomMacro not working View modes: 
User avatar
Member
Member
pt - 4/27/2011 9:45:02 AM
   
ResolveCustomMacro not working
I'm trying to use the "ResolveCustomMacro" method with a custom macro and believe that it is not making the call. Is there some type of global setting required to enable this?

User avatar
Member
Member
kentico_alleng - 4/27/2011 1:10:25 PM
   
RE:ResolveCustomMacro not working
In what way are you using the macro? Is this in a document field, page content, or used in another way?

Have you tried debugging to step through and see if the method gets called?

Regards,

Allen Greenhaw

User avatar
Member
Member
pt - 4/27/2011 5:20:45 PM
   
RE:ResolveCustomMacro not working
Hi Allen,

I'm using the custom macro to set the "Select top N documents" property of a latest news web part.

In the web part property editor I have:
{% ProcessCustomMacro("setnewsitemcounttodisplay", "") %}

In my CMSCustom.cs file I have:
...
switch (expression.ToLower())
{
case "setnewsitemcounttodisplay":
match = true;
result = "4"; // <-- just used for development purposes
break;
}
...

Seems like it should work but it's not.

Paul

User avatar
Member
Member
kentico_alleng - 4/28/2011 12:24:35 PM
   
RE:ResolveCustomMacro not working
It does look like that should work.

Here are a few things you can try:

1. Confirm the file ~\App_Code\Global\CMS\CMSCustom.cs has been saved.
2. Add the macro to an editable text web part to see if/how it's being resolved.
3. Try restarting the site from 'Site Manager -> Administration -> System'.

Regards,

Allen Greenhaw

User avatar
Member
Member
pt - 4/29/2011 6:26:52 AM
   
RE:ResolveCustomMacro not working
Thank you Allen for your help on this. We had already tried items 1 and 3 of your suggestion without success. Unfortunately due to our project time line we had abandon the custom macro approach and instead use a custom function within the transformation. It's not an ideal solution but it works and keeps us moving. Thanks, Paul

User avatar
Member
Member
kentico_alleng - 4/29/2011 10:58:48 AM
   
RE:ResolveCustomMacro not working
Sorry to hear you've been unable to get this working.

If you'd like us to look into this in further detail, please create a support ticket using the information listed in the Support section of kentico.com and attach your CMSCustom.cs file.

Regards,

Allen Greenhaw