Skip to content

liferay custom navigation

September 24, 2012

liferay custom navigation,

As per my requirement first 4 main pages and their subpages need to display..

<%@ taglib uri=”http://java.sun.com/portlet_2_0&#8243; prefix=”portlet” %>
<%@ taglib uri=”http://liferay.com/tld/theme&#8221; prefix=”liferay-theme” %>
<%@page import=”com.liferay.util.portlet.PortletProps”%>
<%@page import=”com.liferay.portal.theme.ThemeDisplay”%>
<%@page import=”com.liferay.portal.model.Layout”%>
<%@page import=”com.liferay.portal.service.LayoutLocalServiceUtil”%>
<%@page import=”java.util.List” %>

<%
int pageIndexStart = Integer.parseInt(PortletProps.get(“page.index.start”));
int pageIndexEnd = Integer.parseInt(PortletProps.get(“page.index.end”));

List<Layout> layoutList = LayoutLocalServiceUtil.getLayouts(themeDisplay.getScopeGroupId(), false, 0, false, pageIndexStart, pageIndexEnd);

%>
<portlet:defineObjects />

<ul style=”list-style-type:none;”>
<%
if(Validator.isNotNull(layoutList) && layoutList.size() > 0) {

for(Layout parentLayout : layoutList) {
System.out.println(“Parent page >>>>>> “+parentLayout.getName(themeDisplay.getLocale()));
%>
<li class=”coursr_flot course_bor_bot course_Marbot”>
<a class=”course_mycou_hd” href=”<%= parentLayout.getFriendlyURL() %>”><%= parentLayout.getName(themeDisplay.getLocale()) %></a>
<ul style=”list-style-type: none; margin: 0px;”>
<%
if(parentLayout.hasChildren()){
for(Layout childLayout : parentLayout.getChildren()){
System.out.println(“— Child page >>>>>> “+childLayout.getName(themeDisplay.getLocale()));
%><li class=”course_viewall_link”><a href=”<%= childLayout.getFriendlyURL() %>”><%= childLayout.getName(themeDisplay.getLocale()) %></a></li> <%
}
}
%>
</ul><br>
</li>
<%
}
}
%>
</ul>

After this in portal.proeperties pass the values..

page.index.start=1
page.index.end=5

About these ads
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

liferayinfo

Value addition to Liferay Portal

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: