Tuesday, June 14, 2011

Get Current Page Details in theme

1) To get current page title
 <portal-fmt:title varname="${wpsSelectionModel.selectedNode}"/>

2) Get selected page
javax.naming.Context ctx = new javax.naming.InitialContext();
com.ibm.portal.model.NavigationSelectionModelHome navigationSelectionModelHome = (com.ibm.portal.model.NavigationSelectionModelHome) ctx.lookup("portal:service/model/NavigationSelectionModel");
final com.ibm.portal.model.NavigationSelectionModelProvider nsmProvider = navigationSelectionModelHome.getNavigationSelectionModelProvider();
            final com.ibm.portal.navigation.NavigationSelectionModel nsm = nsmProvider.getNavigationSelectionModel(request, response);
            com.ibm.portal.model.ContentModelProvider cmProvider = contentModelHome.getContentModelProvider();
            com.ibm.portal.content.ContentModel contentModel = cmProvider.getContentModel( request, response );
           
            final NavigationNode currentNavNode = (NavigationNode) nsm.getSelectedNode();
            final ContentNode currentContentNode = currentNavNode.getContentNode();

3) ChildrenCount of Specific Page
<% String themeLinksUniqueNameRoot = "com.employeeportal.footer"; %>

<portal-navigation:navigation scopeUniqueName="<%=themeLinksUniqueNameRoot%>"  startLevel="1" stopLevel="1">
    <%
        int pageCount=((com.ibm.wps.model.wrappers.NavigationModelWrapper)wpsNavModel).getChildrenCount(((com.ibm.wps.model.wrappers.NavigationModelWrapper)wpsNavModel).findByUniqueName(themeLinksUniqueNameRoot));
     %>
       </portal-navigation:navigation>

No comments:

Post a Comment