Foren

put search box portlet in the theme

Gabor Matyi, geändert vor 15 Jahren.

put search box portlet in the theme

New Member Beiträge: 9 Beitrittsdatum: 27.01.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: put search box portlet in the theme

New Member Beiträge: 9 Beitrittsdatum: 27.01.09 Neueste Beiträge
please help me anybody.

thanks.
thumbnail
Archi Madhu, geändert vor 15 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 237 Beitrittsdatum: 25.03.08 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: put search box portlet in the theme

New Member Beiträge: 9 Beitrittsdatum: 27.01.09 Neueste Beiträge
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...
thumbnail
Zankar Shah, geändert vor 14 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 106 Beitrittsdatum: 03.10.07 Neueste Beiträge
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
thumbnail
Anne D C, geändert vor 14 Jahren.

RE: put search box portlet in the theme

Junior Member Beiträge: 32 Beitrittsdatum: 20.05.09 Neueste Beiträge
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?
thumbnail
zaheer mohammed saddapalli, geändert vor 14 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 165 Beitrittsdatum: 15.01.08 Neueste Beiträge
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.

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


and then add following code

<form id="site_search_form" action="$km_search_portlet_url" method="post" name="_3_fm" onsubmit="submitForm(this); return false;">
			<input type="text" id="site_search" name="_KWA_11_keywords" value="Site search">
			</form>


This is best way for adding any portlet into theme
vcvijayan MCA, geändert vor 14 Jahren.

RE: put search box portlet in the theme

thumbnail
zaheer mohammed saddapalli, geändert vor 14 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 165 Beitrittsdatum: 15.01.08 Neueste Beiträge
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.
thumbnail
nitin kumar sharma, geändert vor 9 Jahren.

RE: put search box portlet in the theme

New Member Beiträge: 12 Beitrittsdatum: 26.04.13 Neueste Beiträge
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...!
thumbnail
Andew Jardine, geändert vor 9 Jahren.

RE: put search box portlet in the theme

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
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.
thumbnail
prabhakar reddy, geändert vor 9 Jahren.

RE: put search box portlet in the theme

New Member Beiträge: 7 Beitrittsdatum: 01.08.13 Neueste Beiträge
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,
thumbnail
Krati Gupta, geändert vor 11 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 119 Beitrittsdatum: 05.12.08 Neueste Beiträge
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 .
thumbnail
Krati Gupta, geändert vor 11 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 119 Beitrittsdatum: 05.12.08 Neueste Beiträge
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
thumbnail
amira princesse, geändert vor 12 Jahren.

RE: put search box portlet in the theme

New Member Beiträge: 7 Beitrittsdatum: 04.01.10 Neueste Beiträge
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

<div class="search_input">

#set ($myPlaceURL = $portletURLFactory.create($request, "customsearch_WAR_CustomSearchportlet_INSTANCE_abcd", $getterUtil.getLong($plid), "RENDER_PHASE"))

${myPlaceURL.setWindowState("maximized")}
${myPlaceURL.setPortletMode("view")}
${myPlaceURL.setParameter("javax.portlet.action", "doSearch")}

<form action="${myPlaceURL.toString()}" method="post" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_fm">  
	<input type="text" name="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search">
	<input type="submit" value="Search">  
		
</form>	


</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
thumbnail
Krati Gupta, geändert vor 11 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 119 Beitrittsdatum: 05.12.08 Neueste Beiträge
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
thumbnail
Rajesh GR, geändert vor 8 Jahren.

RE: put search box portlet in the theme

Regular Member Beiträge: 161 Beitrittsdatum: 08.02.10 Neueste Beiträge
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.