Embedding a Portlet by Portlet Name

If you’d like to embed a specific portlet in the theme, you can hard code it by providing its instance ID and name. Follow these steps:

  1. Open the FreeMarker theme template that you want to embed the portlet in. (portal_normal.ftl is a good choice.

  2. Add the liferay_portlet["runtime"] macro to the template, as shown below. The portlet name must be the same as javax.portlet.name’s value.

    <@liferay_portlet["runtime"]
        instanceId="INSTANCE_ID"
        portletName="PORTLET_NAME"
    />
    

Here’s an example of an embedded portlet declaration that uses the portlet name to embed a web content portlet:

<@liferay_portlet["runtime"]
    portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"
/>

Great! Now you know how to embed a portlet in your theme’s by their name and ID.

« Embedding Portlets in Themes by Entity Type and ActionSetting Default Preferences for an Embedded Portlet »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0