Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Peter Hellstrand
Embedding search portlet in theme
August 6, 2012 8:10 AM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Hi

I need to embed the search portlet in theme. I know about $search, but that is not enough because i need to configure it.

I also read about how to add an instanceable portlet with the the id. How can I configure this.

$theme.runtime("sample_WAR_sampleportlet_INSTANCE_WI4g")

Can I configure on porltlet, save the id, end then delete it. Then all portlets in my theme will have the same configuration? I would like to insert the json settings of what should be included in the search.
Jan Gregor
RE: Embedding search portlet in theme
August 7, 2012 6:27 AM
Answer

Jan Gregor

Rank: Regular Member

Posts: 224

Join Date: October 20, 2010

Recent Posts

Hi ,

Have a look at portal.properties with following lines :

#
# Specify static portlets that cannot be moved and will always appear on
# every layout. Static portlets will take precedence over portlets that may
# have been dynamically configured for the layout.
#
# For example, if you want the Hello World portlet to always appear at the
# start of the iteration of the first column for user layouts, set the
# property "layout.static.portlets.start.column-1" to "47". If you
# want the Hello World portlet to always appear at the end of the second
# column for user layouts, set the property
# "layout.static.portlets.end.column-2" to "47". You can input a
# list of comma delimited portlet ids to specify more than one portlet. If
# the portlet is instanceable, add the suffix "_INSTANCE_abcd" to the
# portlet id, where "abcd" is any random alphanumeric string.
#
# The static portlets are fetched based on the properties controlled by
# custom filters using EasyConf. By default, the available filters are
# user, community, and organization.
#
#layout.static.portlets.start.column-1=3,6
#layout.static.portlets.end.column-1=14
#layout.static.portlets.start.column-2=71_INSTANCE_abcd,7
#layout.static.portlets.end.column-2=34,70
#layout.static.portlets.start.column-3=
#layout.static.portlets.end.column-3=

Regards,
Jan.
Tejas Kanani
RE: Embedding search portlet in theme
August 7, 2012 7:06 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 655

Join Date: January 6, 2009

Recent Posts

Hi Peter,

I think you can try configuring portlet embedded in theme using below code.
1$velocityPortletPreferences.setValue("searchConfiguration", "[b]{searchConfigurationValue}[/b]")
2$theme.runtime("sample_WAR_sampleportlet_INSTANCE_WI4g", $velocityPortletPreferences.toString())
3$velocityPortletPreferences.reset()


In above code we are setting configuration value for your embedded portlet in theme. Same way you can set value for any configuration.

Best way of setting this value could be,
- first add one portlet in any of the page
- set all the configuration which you need
- get that portlet's preference entry from DB table(portletpreferences) and get all configuration values.
- set configuration values using $velocityPortletPreferences.setValue("key", "value") in your embedded portlet instance.

I've not tried this personally but it should work.
Hope this helps.

Thanks & Regards,
Tejas
Peter Hellstrand
RE: Embedding search portlet in theme
August 7, 2012 11:28 PM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Thank you both. Gonna try this out.
Ramesh Reddy
RE: Embedding search portlet in theme
February 15, 2013 12:44 AM
Answer

Ramesh Reddy

Rank: Junior Member

Posts: 32

Join Date: October 17, 2012

Recent Posts

Peter Hellstrand:
Thank you both. Gonna try this out.


Hi Peter,
I have the same requirement, If you found solution please share it...
Peter Hellstrand
RE: Embedding search portlet in theme
March 4, 2013 6:08 AM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Sorry but I didnt