Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Multiple Macros View modes: 
User avatar
Member
Member
jamxi - 5/13/2010 5:45:32 PM
   
Multiple Macros
I'm trying to set the News Lists web part visibility. I only want to display the web part on the news page that lists all the news items and the detail news page. These two Macros appear to work sperately the way I want, but when I add them both it seems like they both get ignored and new list web part is displayed on all pages. What am I missing?

{%cmscontext.currentdocument.documentname == "News"%}

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/18/2010 6:33:47 AM
   
RE:Multiple Macros
Hello,

Regrettably, it's not possible to use both macros this way. I would recommend creating custom macro where you check if current or parent page is 'News' page and return appropriate bool value. Alternatively, you could check if current page is 'News' or current document type (ClassName) is 'CMS.News' using following properties:

CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentName
CMS.CMSHelper.CMSContext.CurrentPageInfo.ClassName

Best Regards,

Martin Dobsicek

User avatar
Member
Member
jamxi - 5/20/2010 2:13:02 PM
   
RE:Multiple Macros
Not sure if I understood what you're suggesting. I ended up just adding some logic in my template which seems to work.

<%
string path = CMS.CMSHelper.CMSContext.CurrentAliasPath;
path = path.Substring(0, 5);

if (path == "/News"){
%>
<cc1:CMSWebPartZone ID="zoneNews" runat="server" />
<%
}
%>

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/23/2010 1:02:26 PM
   
RE:Multiple Macros
Hello,

I meant creating custom macro as described in 'Custom macro' section at http://www.kentico.com/docs/devguide/appendix_a___macro_expressions.htm and check current and parent page there and return true or false value accordingly.

Best Regards,

Martin Dobsicek