Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
shashidhara ml
How to add same search portlet Twice in a same page
January 4, 2013 2:33 AM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

How to add same search portlet Twice in a same page
Juhi Kumari
RE: How to add same search portlet Twice in a same page
January 4, 2013 2:44 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
Make <instanceable>true</instanceable> in liferay-portlet.xml.

Regards
Juhi
shashidhara ml
RE: How to add same search portlet Twice in a same page
January 4, 2013 3:51 AM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

Hi ,
I am getting SaxParser exception. I followed the Steps like below
1. In liferay-portlet.xml for search portlet i add the <instanceable>true</instanceable> like this

<portlet>
<portlet-name>3</portlet-name>
<icon>/html/icons/search.png</icon>
<struts-path>search</struts-path>
<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
<!--<open-search-class>com.liferay.portal.search.PortalOpenSearchImpl</open-search-class>-->
<preferences-owned-by-group>true</preferences-owned-by-group>
<use-default-template>false</use-default-template>
<restore-current-view>false</restore-current-view>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<header-portlet-css>/html/portlet/search/css/main.css</header-portlet-css>
<css-class-wrapper>portlet-search</css-class-wrapper>
<add-default-resource>true</add-default-resource>
<instanceable>true</instanceable>
</portlet>

save the file and i restarted i am getting saxparser exception and i am not able to see a single portlet in my page.it is showing u don't have permission to see.
I attached my ConsoleError please try to help me.

Regards
Shashi
Attachments: ConsoleError.docx (259.1k)
Juhi Kumari
RE: How to add same search portlet Twice in a same page
January 4, 2013 3:56 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
Put <instanceable>true</instanceable> after
<icon>/icon.png</icon>.


Regards
Juhi
shashidhara ml
RE: How to add same search portlet Twice in a same page
January 4, 2013 4:29 AM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

Hi
I am getting the same error.

Regards
Shashi
Juhi Kumari
RE: How to add same search portlet Twice in a same page
January 4, 2013 4:58 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi
Use this
 1<portlet>
 2    <portlet-name>IPCTest</portlet-name>
 3    <icon>/html/icons/search.png</icon>
 4    <struts-path>search</struts-path>
 5    <configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
 6    <preferences-owned-by-group>true</preferences-owned-by-group>
 7    <use-default-template>false</use-default-template>
 8    <restore-current-view>false</restore-current-view>
 9   
10    <instanceable>true</instanceable>
11   
12    <private-request-attributes>false</private-request-attributes>
13    <private-session-attributes>false</private-session-attributes>
14    <header-portlet-css>/html/portlet/search/css/main.css</header-portlet-css>
15    <css-class-wrapper>portlet-search</css-class-wrapper>
16    <add-default-resource>true</add-default-resource>
17</portlet>
.

Its your code only.
I think earlier oder was not correct in liferay-portlet.xml.

Regards
Juhi
shashidhara ml
RE: How to add same search portlet Twice in a same page
January 6, 2013 8:56 PM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

Thanks,it's Working
Saurabh Gupta
RE: How to add same search portlet Twice in a same page
January 8, 2013 9:46 PM
Answer

Saurabh Gupta

Rank: New Member

Posts: 23

Join Date: September 24, 2012

Recent Posts

Hi,

I add 2 search portlet in same page using the same process as you told but for 1st search portlet i want to search all the content like messageboard, web content and for 2nd search portlet only for web content page with particular Tag. i change the Advance search setting by making it static= ture; add the value for Tag like values:"company".
if i add only one then it show the proper result but for when i add both with different setting one as default setting and other with tag for "company" but it is showing the same result.

Thank you for any type of help.
David Kubitza
RE: How to add same search portlet Twice in a same page
March 26, 2013 2:24 AM
Answer

David Kubitza

Rank: New Member

Posts: 10

Join Date: May 13, 2012

Recent Posts

If you're still looking for the answer:

Search Portlet isn't meant to be instanceable, that's why it uses a default namespace which is just the id of the portlet ("3"). However, if you make it instanceable, you will have an id with attached instance id like "3_INSTANCE_adq24fwa3".

You have to hook "/ROOT/html/taglib/ui/search/start.jsp" and add two lines:

1. right after '<%' this: 'namespace = themeDisplay.getPortletDisplay().getId();'
2. after 'portletURL.setParameter("redirect", currentURL);' this: 'namespace = "_" + themeDisplay.getPortletDisplay().getId() + "_";'

This should work, because it will have the right namespace and can get the right preferences for the instance.