Liferay- Drop down Menu Portlet
Here is my Next portlet. Hope you enjoyed the Liferay theme with multilevel dropdown menu. What if you can put that drop down menu as a portlet? Here is what I did for that.
1. Here let’s start by downloading the required files. [dropdown_menu portlet.zip]
2. Put these files in webapps\ROOT\html\portlet\ext\dropdown_menu\
3. Copy the following code to webapps\ROOT\WEB-INF\portlet-ext.xml under <portlet-app> tag
<portlet> <portlet-name>dropdown_menu</portlet-name> <display-name>Dropdown Menu</display-name> <portlet-class>com.liferay.util.bridges.jsp.JSPPortlet</portlet-class> <init-param> <name>view-jsp</name> <value>/html/portlet/ext/dropdown_menu/view.jsp</value> </init-param> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> </supports> <resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle> <security-role-ref> <role-name>guest</role-name> </security-role-ref> <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> </portlet>
4. Copy the following code to webapps\ROOT\WEB-INF\liferay-portlet-ext.xml under <portlets> tag
<portlet> <portlet-name>dropdown_menu</portlet-name> <configuration-action-class>com.liferay.portlet.sitemap.action.ConfigurationActionImpl</configuration-action-class> <portlet-data-handler-class>com.liferay.portlet.sitemap.lar.SitemapPortletDataHandlerImpl</portlet-data-handler-class> <use-default-template>true</use-default-template> <restore-current-view>false</restore-current-view> <layout-cacheable>true</layout-cacheable> <instanceable>true</instanceable> <private-request-attributes>false</private-request-attributes> <private-session-attributes>false</private-session-attributes> <render-weight>50</render-weight> <header-portlet-css>/html/portlet/ext/dropdown_menu/css.jsp</header-portlet-css> <css-class-wrapper>portlet-site-map</css-class-wrapper> <add-default-resource>true</add-default-resource> </portlet>
5. Also make an entry in webapps\ROOT\WEB-INF\liferay-display.xml under <category name=”category.cms”>> as follows
<display> <category name="category.cms"> ...... <portlet id="dropdown_menu" /> </category> ....... </display>
You can even customize the root folder for the drop down menu.
Have you seen the dynamic sitemap portlet? This is a modification of that one. I applied CSS to display the sitemap portlet as a drop down menu. It works pretty well in Firefox and Ie.













What version of Liferay are you using. In 5.2.3 on Tomcat 5.5, the directory structure you mention doesn’t exist…?
@Chris
I am using Liferay 5.2.2 on tomcat 6.0. Liferay 5.2.3 is having same directory structure as in 5.2.2. Are you working in ‘ext’ environment? My instructions are for directly creating portlet inside liferay. You must create a folders ‘ext’ and ‘dropdown_menu’ as specfied in path.
If you are not able to find ‘liferay-portlet-ext.xml’ and ‘portlet-ext.xml’, create new files and paste the code under specified tags.
Sweet Shamzu — I started creating the directory structure hoping that would be your answer ; )
I will now set up the XML files and paste in your code. Drop downs as a portlet should make a globally persistent navigation fairly straight-forward. I tried your google theme, but found that the jedi theme was a better basis for my customization. I am still constrained a little by Jedi so your portlet should be perfect.
Thanks!
Hello Shamzu,
I followed your above steps. But unable to get the navigation CSS and Javascript Working.
I am using the Liferay 5.1.5 Version
Can you provide any help!
Thank you
@Prakash
Upgrade your liferay to 5.2.2. I never tried this on 5.1.5.
Hey Shamzu,
Just tried it with Liferay 5.2.3
Works like a charm.
Thank you.
@Landry
Hi, Thanks for testing it on 5.2.3.
Dear Shamzu
As per my client requirements ..
Can we get individual portlet be embeded in a page from my account [like change password, mydetails change]
I would appreciate all ur help . We are based in CBE also, now that u have left for ISRO doesnt make a difference
Thanks
Kishore
@Chris
Nice to see your reply.. thanks