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!
@Chris
Nice to see your reply.. 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.
hi shamzu,
I am very new to liferay…I want to create my own website like 7cogs using liferay portal,I have downloaded Liferay 5.2.3 source code and liferay-portal-tomcat-6.0-5.2.3 and eclipse3.3. I want to create EXT environment using eclipse for customization of portal.I searched thr’ net but i didn’t get any document as per my query for version liferay5.2.3…CAn u help mme please
Hi,
Im having the same problems as Sucheta. Any of you guys could help?
Regards,
Albab.
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
i follow your intstruction on liferay 5.2.3 and tomcat 6.0.18 but i get this following error
javax.portlet.title.dropdown_menu is temporarily unavailable.
Ok, ive skiped trying to get the ext envioment running plus liferay decided to halt the one i was trying to do and came out with new version aaand thsi is not the right place to ask for that.
But i have a few questions regarding this.
Ive tried this on my school lab for weeks just to get things right.
Plus the cache keeps delaying my work.
So now i have liferay at home and it seems that this portlet dont seem to display correctly for ie7(compability mode) and ie8. Well suprisingly its better with ie7(compability mode). But still the second level submenu (or 1.2.1…as seen on your screenshot) doesnt not display on both.
It runs allright with firefox, abit off with chrome(i can fix this) as well as safari (needs a bit tweaking). So if anyone had a fix for this IE madness that i couldnt put my finger on how to fix it or begin with..please do let me know. Ill post a screen shot on request. Or anyone having the same problem..please share info.
Thanks a lot in advance.
pardon me for my typos. my keyboard is on the floor. long story.
i’ve done all these steps but how can i make a drop down menu and use it?
it s not work in liferay 6.0. :d