Sometimes it is required that we embed a portlet in a theme. We can embed a portlet in a theme through a Velocity template, say, portal_normal.vm.
The embedded portlet usually display a small amount of content. It may be intended for a login screen, for example. It may also be used to display some custom dynamic content. We can use the following steps to add a portlet to a theme:
1. Create a Embed portlet and deploy it.
2. In the portal_normal.vm file of the Noir theme add the following
Velocity code:
<div>
$theme.runtime("embed_WAR_embedportlet_INSTANCE_6CMo")
</div>
Note : Portlet name you can find by clicking on Configuration -> Sharing -> Anywebsite3. Re-deploy the Noir theme and refresh the page. The embedded portlet shows with borders.
4. Click on the configuration icon of the Embed portlet. Click on Look and Feel.
5. Uncheck Show Borders and click on Save.
6. Close Look and Feel and refresh the page – the portlet borders are gone.
You can see This is the Embed portlet in the screenshot above, which is the text displayed by the Embed portlet.
You can also use the following configuration in ${PLUGINS_SDK_HOME}/themes/embed-portlet/docroot/WEB-INF/portlet.xml to turn off the borders:
<portlet-preferences>
<preference>
<name>portlet-setup-show-borders</name>
<value>false</value>
</preference>
</portlet-preferences>
You can even embed multiple portlets in a theme.
The embedded portlet usually display a small amount of content. It may be intended for a login screen, for example. It may also be used to display some custom dynamic content. We can use the following steps to add a portlet to a theme:
1. Create a Embed portlet and deploy it.
2. In the portal_normal.vm file of the Noir theme add the following
Velocity code:
<div>
$theme.runtime("embed_WAR_embedportlet_INSTANCE_6CMo")
</div>
Note : Portlet name you can find by clicking on Configuration -> Sharing -> Anywebsite3. Re-deploy the Noir theme and refresh the page. The embedded portlet shows with borders.
4. Click on the configuration icon of the Embed portlet. Click on Look and Feel.
5. Uncheck Show Borders and click on Save.
6. Close Look and Feel and refresh the page – the portlet borders are gone.
You can see This is the Embed portlet in the screenshot above, which is the text displayed by the Embed portlet.
You can also use the following configuration in ${PLUGINS_SDK_HOME}/themes/embed-portlet/docroot/WEB-INF/portlet.xml to turn off the borders:
<portlet-preferences>
<preference>
<name>portlet-setup-show-borders</name>
<value>false</value>
</preference>
</portlet-preferences>
You can even embed multiple portlets in a theme.
again.......well written..!!!!
ReplyDeleteThanks for your post!
ReplyDeleteYou can follow the below link.
ReplyDeletehttp://tariqliferay.blogspot.com/2015/02/how-to-add-portlet-in-liferay-theme.html
Nice tutorial!
ReplyDeleteI have make some new liferay theme, you can download free at www.liferaytheme.com
Nice woork i was looking for somthing like this clean and simple.
ReplyDeleteMấy bạn có thể chỉ mình cách tạo footer không. cảm ơn các bạn
ReplyDeleteMấy bạn có thể chỉ mình cách tạo footer không. cảm ơn các bạn
ReplyDeletethank you :). straight and easy
ReplyDelete