Combination View Flat View Tree View
Threads [ Previous | Next ]
Daniel Lipski
$taglibLiferay.runtime help
April 19, 2011 7:47 AM

Daniel Lipski

Rank: New Member

Posts: 3

Join Date: April 13, 2011

Recent Posts


Im new Liferay user/developer so please foregive me if I misunderstood something.

What Im trying to do is to develop custom theme and "include" custom portled inside velocity template.

1)I devloped simple helo-world portlet and deployed it to Liferay.
deploment type: plugin (subfolder in tomcat webapps)

2)I developed simple theme and override one of velocity templates (portal_normal.vm).
In the template I added few lines of velcity code:
1#set ($VOID = $velocityPortletPreferences.setValue('display-style', '1'))
2#set ($VOID = $velocityPortletPreferences.setValue('portlet-setup-show-borders', 'false'))
3#set ($myPortletId = "[b]MyPortlet_INSTANCE_E3j7_WAR_MyPortlet-portlet[/b]")
4$taglibLiferay.runtime($myPortletId, '', $velocityPortletPreferences.toString())
5#set ($VOID = $velocityPortletPreferences.reset())

3)When I deploy this theme and refresh page nothing is displayed in place of this "inclusion". When I add my portlet with page->add->... Hello world appears.

I debug Liferay for a whole day and probably found a cause.

Its in the RuntimePortletUtil.processPortlet(...) method:

1String instanceId = portlet.getInstanceId();

For my template this instanceId = "E3j7_WAR_MyPortlet-portlet"
As I suspect the correct version should be only "E3j7".

Thats why few lines of code below validation fails (id length != 4) and "Portlet is instanceable but does not have a valid instance id" is displayed.

Ive tried with difrrent portledId passed to $taglibLiferay.runtime but nothing work.
Regarding to this wiki page my Id should work:wiki

Do I do something wrong ? What is a difference beetween $taglibLiferay.runtime and $theme.runtime ??

Reagrds Daniel
Eduardo P. Garcia
RE: $taglibLiferay.runtime help
April 30, 2012 5:07 AM

Eduardo P. Garcia


Rank: Regular Member

Posts: 127

Join Date: March 15, 2012

Recent Posts

Hi Daniel,

This is what you are doing wrong:

3#set ($myPortletId = "[b]MyPortlet_INSTANCE_E3j7_WAR_MyPortlet-portlet[/b]")

Your portletId should be:

3#set ($myPortletId = "[b]MyPortlet_WAR_MyPortlet-portlet_INSTANCE_E3j7[/b]")

In other words, the right scheme is:


where [...] is only for instanceable portlets.

As for the differences between $taglibLiferay.runtime and $theme.runtime, if you are using Liferay 6.0 or above, you must use $theme.runtime instead of $taglibLiferay.runtime to embed portlet.

For more information, you can visit this Wiki: Embedding a portlet in a Theme

richard naoufal
RE: $taglibLiferay.runtime help
August 21, 2013 5:47 AM

richard naoufal

Rank: Junior Member

Posts: 34

Join Date: April 4, 2013

Recent Posts


Is it possible to change the language of a page by adding a language portlet, changing the preferences and choosing a language this way ?

Thank you !

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!