Home > My Works, software, Tech > Liferay- Drop down Menu Portlet

Liferay- Drop down Menu Portlet


Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

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.

drop down portlet1. 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.

  1. Chris
    June 9, 2009 at 8:05 pm | #1

    What version of Liferay are you using. In 5.2.3 on Tomcat 5.5, the directory structure you mention doesn’t exist…?

    • June 9, 2009 at 9:41 pm | #2

      @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.

      • Chris
        June 11, 2009 at 9:16 pm | #3

        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!

      • June 11, 2009 at 9:57 pm | #4

        @Chris
        Nice to see your reply.. thanks :D

  2. Prakash
    August 11, 2009 at 11:50 am | #5

    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

    • August 11, 2009 at 6:48 pm | #6

      @Prakash
      Upgrade your liferay to 5.2.2. I never tried this on 5.1.5.

  3. October 8, 2009 at 5:03 am | #7

    Hey Shamzu,
    Just tried it with Liferay 5.2.3
    Works like a charm.
    Thank you.

    • October 8, 2009 at 2:19 pm | #8

      @Landry
      Hi, Thanks for testing it on 5.2.3.

  4. sucheta
    December 10, 2009 at 12:13 pm | #9

    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

    • Achmed Tyrannus Albab
      March 22, 2010 at 3:56 pm | #10

      Hi,
      Im having the same problems as Sucheta. Any of you guys could help?

      Regards,
      Albab.

  5. December 23, 2009 at 1:10 pm | #11

    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

  6. yan
    January 28, 2010 at 2:18 pm | #12

    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.

  7. Achmed Tyrannus Albab
    May 5, 2010 at 8:26 pm | #13

    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.

  8. Achmed Tyrannus Albab
    May 5, 2010 at 8:29 pm | #14

    pardon me for my typos. my keyboard is on the floor. long story.

  9. susan
    November 22, 2010 at 1:29 pm | #15

    i’ve done all these steps but how can i make a drop down menu and use it?

  10. April 27, 2011 at 4:03 pm | #16

    it s not work in liferay 6.0. :d

  1. No trackbacks yet.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 42 other followers