Foren

Using runtime portlet tag in wcm template

thumbnail
Thomas Berg, geändert vor 9 Jahren.

Using runtime portlet tag in wcm template

Regular Member Beiträge: 131 Beitrittsdatum: 07.09.09 Neueste Beiträge
Hi,

EDIT: Forgot to mention which version I'm using: Liferay 6.2.1 CE GA2

I've been trying the example by Barrie Selack:
http://www.liferay.com/web/barrie.selack/blog/-/blogs/embedding-a-portlet-in-web-content

The basic examples are working fine but I need to set some default preferences and cannot get it to work:

(47 is the "Welcome Portlet")


#set ($defaultPrefs = "
<portlet-preferences>
    <preference>
        <name>portletSetupShowBorders</name>
        <value>false</value>
    </preference>
</portlet-preferences>
")

<runtime-portlet name="47" instance="$article-reserved-id.data" defaultPreferences="$escapeTool.xml($defaultPrefs)" />


I have also tried using


<runtime-portlet name="47" instance="$article-reserved-id.data" defaultPreferences="portletSetupShowBorders=false" />


and


<runtime-portlet name="47" instance="$article-reserved-id.data" queryString="portletSetupShowBorders=false" />


But to no avail!

Anyone tried this and know if I'm doing something wrong?

Regards Thomas
thumbnail
Mario R, geändert vor 8 Jahren.

RE: Using runtime portlet tag in wcm template

Junior Member Beiträge: 55 Beitrittsdatum: 06.06.13 Neueste Beiträge
Hi!
I have the same problem!!
Some ideas?

I tried different approaches:

Using portlet-setup-show-borders

#set($preferences = $stringUtil.insert("<portlet-preferences>", "<preference>", 9999))
#set($preferences = $stringUtil.insert($preferences, "<name>portlet-setup-show-borders</name>", 9999))
#set($preferences = $stringUtil.insert($preferences, "<value>false</value>", 9999))
#set($preferences = $stringUtil.insert($preferences, "</preference>", 9999))
#set($preferences = $stringUtil.insert($preferences, "</portlet-preferences>", 9999))


Using the portletSetupShowBorders

#set($preferences = $stringUtil.insert("<portlet-preferences>", "<preference>", 9999))
#set($preferences = $stringUtil.insert($preferences, "<name>portletSetupShowBorders</name>", 9999))
#set($preferences = $stringUtil.insert($preferences, "<value>false</value>", 9999))
#set($preferences = $stringUtil.insert($preferences, "</preference>", 9999))
#set($preferences = $stringUtil.insert($preferences, "</portlet-preferences>", 9999))


The two firsts approaches return the error: The value of attribute defaultPreferences associated with an element type runtime-portlet must not contain the '<' character.

Using manually string escape:

#set($preferencias = $stringUtil.insert("&lt;portlet-preferences&gt;", "&lt;preference&gt;", 9999))
#set($preferencias = $stringUtil.insert($preferencias, "&lt;name&gt;portlet-setup-show-borders&lt;/name&gt;", 9999))
#set($preferencias = $stringUtil.insert($preferencias, "&lt;value&gt;false&lt;/value&gt;", 9999))
#set($preferencias = $stringUtil.insert($preferencias, "&lt;/preference&gt;", 9999))
#set($preferencias = $stringUtil.insert($preferencias, "&lt;/portlet-preferences&gt;", 9999))


Using this approach no errors are generated, but the preference isn't applied!


<runtime-portlet name="73" instance="" queryString="" defaultPreferences="$preferences" />



Atte:
Mario