Jul 23, 2013

Embed portlet in theme

  • Create a portlet with any name you want, EX. "portlet-embedded".
  • Write your code in portlet (view.jsp) to be displayed.
  • After adding your code to the portlet deploy the portlet so it is available for to use in theme.
  • Embedding portlet in theme
    • Open the velocity template file in which you want to embed the portlet.
    • Add below code in velocity template.
Code snippet

<div id="embedded-test-div">
$theme.runtime("headercart_WAR_headercartportlet","queryString", $velocityPortletPreferences.toString())

  • The Red marked line is for to embed a portlet in to theme
    • name="headercart_WAR_headercartportlet" the name of your portlet to be embedded with.
    • queryString="" give queryString if any other wise blank as it is optional.
    • You can set preferences using velocityPortletPreferences string or give blank this is also optional.
  • You are done now deploy the theme and you will get the porltet embedded with theme.
  • For more information do visit the link

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.