Embed portlet in liferay 7 FTL theme

To include portlet in liferay 7 ftl theme , use the code as follows.


<@liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
instanceId="blablabla1"
portletName="com_liferay_site_navigation_directory_web_portlet_SitesDirectoryPortlet"
/>

where ,
instanceId="blablabla1" have to be given only for instanceable portlet,
"com_liferay_site_navigation_directory_web_portlet_SitesDirectoryPortlet" is portletId.





Comments

  1. Hi,

    I am trying to embed a portlet into the theme, but nothing will show up.
    First I created via blade a portlet provider which already contains a portlet preconfigured as a AddPortletProvider. Then I changed it to a ViewPortletProvider.

    After that I tried to embed the portlet the way you mentioned above.

    But nothing will show up, no errors.


    Thx for every feedback, I appreciate that.

    ReplyDelete
  2. In addition, I did not use the instanceId property mentioned above.

    ReplyDelete
    Replies
    1. Please check whether you have given correct portlet name. And, instanceId have to be given only for instanceable portlet as I mentioned in the post.

      Delete
    2. Hi,

      this is what I have implemented

      <@liferay_portlet["runtime"]
      defaultPreferences="${freeMarkerPortletPreferences}"
      portletProviderAction=portletProviderAction.VIEW
      portletName="DisplayMessagesViewPortletProvider2"
      />

      The portlet component header is:

      "javax.portlet.name=" + DisplayMessagesViewPortletProviderPortletKeys.DisplayMessagesViewPortletProvider

      And behind "DisplayMessagesViewPortletPovider" = DisplayMessagesViewPortletProvider2


      If I changed the name of the porlet in the ftl. There is an error which cannot find the portlet with the name...



      Delete
    3. Thx for the hints.

      My portlet was instanceable, so I set it to false in the component header and then the content showed up.

      After you said instanceId, I checked my portlet again.

      Thx again.

      Delete

Post a Comment

Popular posts from this blog

Liferay 7 overriding MVC Commands

Liferay migration to version 7.x

Liferay Popups