Thursday, June 10, 2010

How to embed portlet in theme? Part 1

Liferay version: 5.2.3

Embedding portlet in theme means we want to put coding in velocity files. For example, I need to embed last update portlet in a velocity file named as footer.vm.

There are three steps.
1.Install portlet using Plugin Installer. Go to Control Panel > Plugin Installer > Install more portlet > Upload file. The .WAR file for last update can be downloaded here.
2.Set the instanceable properties to false. Path: ~/server/tomcat-6.0.18/webapps/last_update-portlet/WEB-INF/liferay-portlet.xml

3.Get the portlet ID. Then put this code, $theme.runtime(“portlet_ID”)


For this example, $theme.runtime("lastupdate_WAR_last_updateportlet")
Result:



Click image to enlarge. The last update status appear in the last line.