Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gabor Matyi
put search box portlet in the theme
March 12, 2009 4:42 AM
Answer

Gabor Matyi

Rank: New Member

Posts: 9

Join Date: January 27, 2009

Recent Posts

Hi!

I'd like to put a searchbox portlet in my theme.

I put this line to the portal_normal.vm

$taglibLiferay.runtime("3_INSTANCE_zzzz", "", "<portlet-preferences><preference><name>portlet-setup-show-borders</name><value>false</value></preference></portlet-preferences>")

I don't get any searbox, but I get twice
"Search - Look and Feel - Configuration"
Search - Look and Feel - Configuration

and I see once this text.

You do not have the roles required to access this portlet.

Could anybody please help me, what do I wrong?

Thanks Gabor Matyi
Gabor Matyi
RE: put search box portlet in the theme
March 14, 2009 12:10 PM
Answer

Gabor Matyi

Rank: New Member

Posts: 9

Join Date: January 27, 2009

Recent Posts

please help me anybody.

thanks.
Archi Madhu
RE: put search box portlet in the theme
March 14, 2009 12:31 PM
Answer

Archi Madhu

Rank: Regular Member

Posts: 240

Join Date: March 24, 2008

Recent Posts

Gabor Matyi:
please help me anybody.

thanks.


Hi,

you can incluse searchbox portlet in theme by

$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("56_INSTANCE_a123", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()


Replace 56_INSTANCE_a123 with your search box portlet id

Regards,
Archi Madhua
Gabor Matyi
RE: put search box portlet in the theme
March 15, 2009 1:49 AM
Answer

Gabor Matyi

Rank: New Member

Posts: 9

Join Date: January 27, 2009

Recent Posts

Thanks you help.

your solution works with 56_INSTANCE_...., but not with 3_INSTANCE....

what I need: to put a searchbox in the template ... you see similar on the site liferay.com.

Probably there is any issue with including this portlet...
Zankar Shah
RE: put search box portlet in the theme
August 18, 2009 11:45 PM
Answer

Zankar Shah

Rank: Regular Member

Posts: 105

Join Date: October 3, 2007

Recent Posts

Try this out

<div class="search">
$theme.journalContentSearch()
</div>

Not sure may be it is internally doing the same thing which is written in forum.
This is in one of the liferay-noir theme. Check that for reference
Anne D C
RE: put search box portlet in the theme
August 26, 2009 4:53 AM
Answer

Anne D C

Rank: Junior Member

Posts: 32

Join Date: May 20, 2009

Recent Posts

Thanks, that works just fine! Even thought I'm working with Liferay 4.3.2

My only question is: The search button (an input as I can see at the source code) appears as a magnifying glass, how can I change it to a simple button?
I proved through CSS using the input tag, but it didn't work.

Any idea?
zaheer mohammed saddapalli
RE: put search box portlet in the theme
August 26, 2009 5:18 AM
Answer

zaheer mohammed saddapalli

Rank: Regular Member

Posts: 164

Join Date: January 15, 2008

Recent Posts

Gabor Matyi:
Hi!

I'd like to put a searchbox portlet in my theme.

I put this line to the portal_normal.vm

$taglibLiferay.runtime("3_INSTANCE_zzzz", "", "<portlet-preferences><preference><name>portlet-setup-show-borders</name><value>false</value></preference></portlet-preferences>")

I don't get any searbox, but I get twice
"Search - Look and Feel - Configuration"
Search - Look and Feel - Configuration

and I see once this text.

You do not have the roles required to access this portlet.

Could anybody please help me, what do I wrong?

Thanks Gabor Matyi


Hi Gabor,

I have added my custom search portlet inn theme.

1#set ($km_search_portlet_url = $portletURLFactory.create($request, "KWA_11", $page.getPlid(), "RENDER_PHASE"))
2            $km_search_portlet_url.setWindowState("maximized")
3            $km_search_portlet_url.setPortletMode("view")
4            $km_search_portlet_url.setParameter("struts_action", "/ext/km_search/search")


and then add following code
1
2<form id="site_search_form" action="$km_search_portlet_url"method="post" name="_3_fm" onsubmit="submitForm(this); return false;">
3            <input type="text" id="site_search" name="_KWA_11_keywords" value="Site search" />
4            </form>


This is best way for adding any portlet into theme
Anonymous
RE: put search box portlet in the theme
September 2, 2009 7:03 AM
Answer

Anonymous

Hi Zaheer,

Incude the following line in you portlet.vm file or in any .vm file you will get search box.

$theme.journalContentSearch()



Thanks in Advance,

V.C.Vijayan
Software Developer, TransIT mPower Labs (P) Ltd.
info@mpowerglobal.com
mPower Global Inc.
A Liferay expert company.
zaheer mohammed saddapalli
RE: put search box portlet in the theme
September 3, 2009 2:05 AM
Answer

zaheer mohammed saddapalli

Rank: Regular Member

Posts: 164

Join Date: January 15, 2008

Recent Posts

vcvijayan MCA:
Hi Zaheer,

Incude the following line in you portlet.vm file or in any .vm file you will get search box.

$theme.journalContentSearch()



Thanks in Advance,

V.C.Vijayan
Software Developer, TransIT mPower Labs (P) Ltd.
info@mpowerglobal.com
mPower Global Inc.
A Liferay expert company.



Hi Vijayan,

You are right for adding existing search portlet on theme.

Here i am talking about adding custom search.


anyway thanks for you post.

S Mohammed Zaheer
Senior Software Developer,
mohammed.zaheer@infoaxon.com
Infoaxon Technologies.
Amira princesse
RE: put search box portlet in the theme
April 12, 2011 9:08 AM
Answer

Amira princesse

Rank: New Member

Posts: 8

Join Date: January 4, 2010

Recent Posts

I have also the same problème

i've created a custom search portlet that I wish to includ in the top of the theme.


this is the VM code
 1
 2<div class="search_input">
 3
 4#set ($myPlaceURL = $portletURLFactory.create($request, "customsearch_WAR_CustomSearchportlet_INSTANCE_abcd", $getterUtil.getLong($plid), "RENDER_PHASE"))
 5
 6${myPlaceURL.setWindowState("maximized")}
 7${myPlaceURL.setPortletMode("view")}
 8${myPlaceURL.setParameter("javax.portlet.action", "doSearch")}
 9
10<form action="${myPlaceURL.toString()}" method="post" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_fm" > 
11    <input type="text" name="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search"  id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search"/>
12    <input type="submit" value="Search" type="submit" /> 
13       
14</form>   
15
16
17</div>


and when click on the search buttom of my portlet I get :

You do not have the roles required to access this portlet.


could any of you help me plz
Krati Gupta
RE: put search box portlet in the theme
July 30, 2012 6:39 AM
Answer

Krati Gupta

Rank: Regular Member

Posts: 113

Join Date: December 5, 2008

Recent Posts

Hi,

Your Code works for me but some error , it will be great if u help me in my issue also , the following is the issue :

My Code :

#set ($tabs1URL = $portletURLFactory.create($request, "ABC", $page.getPlid(), "RENDER_PHASE"))
$tabs1URL.setWindowState("maximized")
$tabs1URL.setPortletMode("view")
$tabs1URL.setParameter("tabs1","Basic")

$tabs1URL.setParameter("struts_action", "/ABC/viewSearch")


<form id="fm" action="$tabs1URL" method="post" name="ABC" onsubmit="submitForm(this); return false;">
<input type="textbox" style="height: 24px; width: 200px;" id="uname1" name="uname1" value="People Search" onFocus="if (this.value == 'People Search') { this.value = ''; }" />
<input type="hidden" name="flag" id="flag" value="true"/>
<input type="submit" id="nsubmit" name="nsubmit" value="Search" />
</form>

By applying above code in theme my custom search textbox is coming in theme, but when I search any keyword its show only one result which I have searched from People Search Module .as per my debugging my struts_action is not calling , when i am searching from theme text box .
Krati Gupta
RE: put search box portlet in the theme
July 30, 2012 11:14 PM
Answer

Krati Gupta

Rank: Regular Member

Posts: 113

Join Date: December 5, 2008

Recent Posts

Hi Amira,

By seeing your code their some error which are as below:

changed this ------ ${myPlaceURL.setParameter("javax.portlet.action", "doSearch")} to ${myPlaceURL.setParameter(("struts_action", "("struts_action", "/abc/view")}

and action="${myPlaceURL.toString()} to action="$myPlaceURL
Krati Gupta
RE: put search box portlet in the theme
August 2, 2012 11:55 PM
Answer

Krati Gupta

Rank: Regular Member

Posts: 113

Join Date: December 5, 2008

Recent Posts

Hi All,

I found the solution of my problem :

I have to replace this #set ($tabs1URL = $portletURLFactory.create($request, "ABC", $page.getPlid(), "RENDER_PHASE"))

to this ---- #set($tabs1URL = $portletURLFactory.create($request, "ABC", $page.getPlid(), "ACTION_PHASE"))

and after that its start working for me ...emoticon emoticon
nitin kumar sharma
RE: put search box portlet in the theme
April 29, 2014 11:49 PM
Answer

nitin kumar sharma

Rank: New Member

Posts: 12

Join Date: April 25, 2013

Recent Posts

vcvijayan MCA:
Hi Zaheer,

Incude the following line in you portlet.vm file or in any .vm file you will get search box.

$theme.journalContentSearch()



Thanks in Advance,

V.C.Vijayan
Software Developer, TransIT mPower Labs (P) Ltd.
info@mpowerglobal.com
mPower Global Inc.
A Liferay expert company.



Thanks
I am stuck with same problem it works fine for me...

please keep sharing...!
Andrew Jardine
RE: put search box portlet in the theme
October 16, 2014 7:17 PM
Answer

Andrew Jardine

Community Moderator

Rank: Liferay Legend

Posts: 1062

Join Date: December 22, 2010

Recent Posts

Just in case anyone comes across this and is looking for a FEDERATED search and not the Web Content Search, you can add the "Search" portlet using $theme.search(); .. I feel like there was also a macro (in velocity) -- something like #search() but I may be mistaken.
prabhakar reddy
RE: put search box portlet in the theme
December 17, 2014 1:15 AM
Answer

prabhakar reddy

Rank: New Member

Posts: 7

Join Date: August 1, 2013

Recent Posts

Hi All,

I want to display the searched content in other specific page which i created for searched content. how to pass page url to this $theme.search().

Thanks,
Rajesh GR
RE: put search box portlet in the theme
March 22, 2016 12:44 AM
Answer

Rajesh GR

Rank: Regular Member

Posts: 157

Join Date: February 7, 2010

Recent Posts

Krati Gupta:
Hi Amira,

By seeing your code their some error which are as below:

changed this ------ ${myPlaceURL.setParameter("javax.portlet.action", "doSearch")} to ${myPlaceURL.setParameter(("struts_action", "("struts_action", "/abc/view")}

and action="${myPlaceURL.toString()} to action="$myPlaceURL


Hi Krati Gupta,
I m trying to get the attribute value "userName" from the custom portlet placed in Theme header part in portal_normal.vm file. Can somebody please suggest me the approach to handle this,
In Portal_normal.vm:
${tabs1URL.setWindowState("maximized")}
${tabs1URL.setPortletMode("view")}
${tabs1URL.setParameter("tabs1","Basic")}
${tabs1URL.setParameter("javax.portlet.action", "getUsernameDetails")}
<input type="text" name="userName" id="userName" class="form-control height30px searchtextBox" placeholder="Search User Name" />
<button type="submit" value="" alt="SomeAlternateText"></button>
In Controller:
public void getUsernameDetails(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {

String userName= ParamUtil
.getString(actionRequest, "userName");

Thanks In Advance,
Regards,
Rajesh.