Fórum

$taglibLiferay.runtime help

Daniel Lipski, modificado 13 Anos atrás.

$taglibLiferay.runtime help

New Member Postagens: 3 Data de Entrada: 13/04/11 Postagens Recentes
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:
#set ($VOID = $velocityPortletPreferences.setValue('display-style', '1'))
#set ($VOID = $velocityPortletPreferences.setValue('portlet-setup-show-borders', 'false'))
#set ($myPortletId = "[b]MyPortlet_INSTANCE_E3j7_WAR_MyPortlet-portlet[/b]")
$taglibLiferay.runtime($myPortletId, '', $velocityPortletPreferences.toString())
#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:

String 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
thumbnail
Eduardo P. García, modificado 3 Anos atrás.

RE: $taglibLiferay.runtime help

Regular Member Postagens: 157 Data de Entrada: 16/03/12 Postagens Recentes
Hi Daniel,

This is what you are doing wrong:


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


Your portletId should be:


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


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, modificado 10 Anos atrás.

RE: $taglibLiferay.runtime help

Junior Member Postagens: 34 Data de Entrada: 04/04/13 Postagens Recentes
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 !