Fórum

Embedding portlet into layout template with settings

Frédéric Aubé, modificado 8 Anos atrás.

Embedding portlet into layout template with settings

Junior Member Postagens: 37 Data de Entrada: 17/07/14 Postagens Recentes
Hi,

I want a portlet (Asset Publisher) into my layout template. The wiki gave me the ID : 101
I can embed my portlet , but the settings are default.
$theme.runtime("101_INSTANCE_abcd", "", "")

In here, i have some tips to include some settings but i don't know how...
I need the advanced styling, asset selection and display settings the the Asset Publisher.
I replaced my code by this one :
	$velocityPortletPreferences.setValue( "_86_displayStyle", "full-content" )
	$velocityPortletPreferences.setValue( "_86_queryName0", "assetTags" )
	$velocityPortletPreferences.setValue( "_86_queryTagNames0", "$tagName" )
	$velocityPortletPreferences.setValue( "_86_rssDisplayStyle", "abstract" )
	$velocityPortletPreferences.setValue( "_86_rssName", "Asset Publisher" )
	$velocityPortletPreferences.setValue( "_86_scopeIds", $scopeId )
	$velocityPortletPreferences.setValue( "_86_selectionStyle", "dynamic" )	
$theme.runtime("101_INSTANCE_abcd", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset() 

This thing doesn't seems to work for me, or i dont get it...

Liferay 6.2 CE GA3

Thank you for help
thumbnail
Jan Geißler, modificado 8 Anos atrás.

RE: Embedding portlet into layout template with settings

Liferay Master Postagens: 735 Data de Entrada: 05/07/11 Postagens Recentes
If I am not wrong, you should strip th:
_86_
part of the parameters. You don't have to Namespace properties.
Frédéric Aubé, modificado 8 Anos atrás.

RE: Embedding portlet into layout template with settings

Junior Member Postagens: 37 Data de Entrada: 17/07/14 Postagens Recentes
I removed "_86_" but it doesn't work for me too
thumbnail
Andew Jardine, modificado 8 Anos atrás.

RE: Embedding portlet into layout template with settings

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Frederic,

One trick I have used for portlets with a lot of settings like this --

1. Add the portlet to the page (like any other portlet, not embedded)
2. Configure the settings and save
3. Go into the database and find the page you just added this portlet to (from the Layout table) -- usually easiest using the friendlyURL
4. Make note of the plid for the column
5. Run a query on the PortletPreferences table filtering by the plid from step #4.
6. You should see your asset publisher portlet (101)
7. Grab the value from the preferences column (should be XML)

.. now use the key/value settings from that string in your velocity tempate using the logic you have except leave off the instace id from your keys. The reason I like to use this approach is that it ensures that the key values you use when embedding your preferences are the correct ones. Hope that helps.
Frédéric Aubé, modificado 8 Anos atrás.

RE: Embedding portlet into layout template with settings

Junior Member Postagens: 37 Data de Entrada: 17/07/14 Postagens Recentes
Thanks, i used your step and i found the xml very easily!
I have all parameter's names and values, you saved me a lot of time.

Now i just need to make it works, atm parameters are not used by the portlet.
Frédéric Aubé, modificado 8 Anos atrás.

RE: Embedding portlet into layout template with settings

Junior Member Postagens: 37 Data de Entrada: 17/07/14 Postagens Recentes
Thanks, i almost did it!

Just one more thing, only 2 tags must be in my asset publisher but when i choose my template in Liferay i get all kind of web content.
I have to get in setup of my portlet and save it.
Only after that step, the portlet is ok. If i dont do that, he doesn't choose only my 2 tags.

#set ($VOID = $velocityPortletPreferences.setValue('queryContains0', 'true'))
#set ($VOID = $velocityPortletPreferences.setValue('queryName0', 'assetTags'))
#set ($VOID = $velocityPortletPreferences.setValue('queryValues0', 'TAG1,TAG2'))