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

Daniel Lipski

Rank: New Member

Posts: 3

Join Date: April 13, 2011

Recent Posts

Hi,

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.
project_name:MyPortlet-portlet
portlet_id:MyPortlet
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
Answer

Eduardo P. Garcia

LIFERAY STAFF

Rank: New Member

Posts: 9

Join Date: March 15, 2012

Recent Posts

Hi Daniel,

This is what you are doing wrong:

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


Your portletId should be:

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


In other words, the right scheme is:

<portletId>_WAR_<webapplicationcontext>[_INSTANCE_xyz1]

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

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

richard naoufal

Rank: Junior Member

Posts: 30

Join Date: April 4, 2013

Recent Posts

Hello,

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 !