Foros de discusión

How to add the search portlet to a Liferay 7 theme

thumbnail
William Gosse, modificado hace 7 años.

How to add the search portlet to a Liferay 7 theme

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
Can someone tell me how to add the search portlet to a Liferay 7 theme. I'm using the styled Freemarker theme as my starting point.

This use to be pretty easy in velocity with 6.2. All I did was add the following:
$theme.search()

I've used velocity a lot in the past but I'm kind of new to Freemarker. It seems similar but still has some differences.

It seems like 7 no longer supports velocity?
thumbnail
William Gosse, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme (Respuesta)

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
I finally figured this out :
<@liferay.search/>

Its a freemarker macros similar to how a the breadcumb portlet is added.
thumbnail
John Arguedas, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensajes: 5 Fecha de incorporación: 30/08/16 Mensajes recientes
Hi, im new to Liferay, im working with themes .ftl , can you tell me where i can find documentation about the available Liferay's functions?
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
There are a couple of places to reference. They're a little trickier to find now from where they used to be but here is a link to on of the files.

github.com/liferay/liferay-portal/blob/7.0.x/modules/apps/foundation/frontend-theme/frontend-theme-unstyled/src/main/resources/META-INF/resources/_unstyled/templates/init.ftl

One of the core benefits of using FTL though is that you can use the tag libraries in your templates. Once you get used to the new syntax, you'll never look back.
thumbnail
John Arguedas, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensajes: 5 Fecha de incorporación: 30/08/16 Mensajes recientes
Thanks for your time. I am looking for functions like:
<@liferay.breadcrumbs />
<@liferay.control_menu />
<@liferay.search/>
...
thumbnail
Andrew Jardine, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
The file you are looking for is called FTL_liferay.ftl -- and you can find it in the source tree under modules/apps/foundation/portal-template/portal-template-freemarker/src/main/resources -- or here: https://github.com/liferay/liferay-portal/blob/master/modules/apps/foundation/portal-template/portal-template-freemarker/src/main/resources/FTL_liferay.ftl
thumbnail
William Gosse, modificado hace 7 años.

RE: How to add the search portlet to a Liferay 7 theme (Respuesta)

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
I added the search portlet to the end of the nav bar with the following in the navigation.ftl file:

<nav class="${nav_css_class} navbar navbar-inverse" id="navigation" role="navigation">
	<h1 class="hide-accessible">&lt;@liferay.language key="navigation" /&gt;</h1>

	<ul class="nav navbar-nav" aria-label="<@liferay.language key=" site-pages"></ul>" role="menubar"&gt;
		&lt;#list nav_items as nav_item&gt;
                    ... normal navbar stuff here
		<!--#list-->
	        <li id="mysearch">
			&lt;@liferay.search/&gt;
		</li>
	
</nav>

Archivos adjuntos:

Asmaa Chadouli, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensajes: 2 Fecha de incorporación: 30/08/17 Mensajes recientes
I added the search portlet to nav bar in navigation.ftl file,

[<nav class="${nav_css_class}" id="navigation" role="navigation">
<h1 class="hide-accessible"><@liferay.language key="navigation" /></h1>

<ul aria-label="<@liferay.language key="site-pages" />" role="menubar">
<#list nav_items as nav_item>
list.....
</#list>
<li id="mysearch">
<@liferay.search/>
</li>
</ul>
</nav>]

But i still have the problem,portlet search doesn't appear in my page
thumbnail
Massimo Bevilacqua, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Regular Member Mensajes: 210 Fecha de incorporación: 27/12/16 Mensajes recientes
Hi Asmaa,

could you please paste all your navigation.ftl code?
thumbnail
William Gosse, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
See attached file.

Archivos adjuntos:

thumbnail
Massimo Bevilacqua, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Regular Member Mensajes: 210 Fecha de incorporación: 27/12/16 Mensajes recientes
Hi,

I just copied your code in my navigation.ftl and I can see the search form



but I didn't find this code inside your file:
[<nav class="${nav_css_class}" id="navigation" role="navigation">
<h1 class="hide-accessible">&lt;@liferay.language key="navigation" /&gt;</h1>

<ul aria-label="<@liferay.language key=" site-pages"></ul>" role="menubar"&gt;
&lt;#list nav_items as nav_item&gt;
list.....
<!--#list-->
<li id="mysearch">
&lt;@liferay.search/&gt;
</li>

</nav>]
thumbnail
William Gosse, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
That's what you wanted right?
thumbnail
Massimo Bevilacqua, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Regular Member Mensajes: 210 Fecha de incorporación: 27/12/16 Mensajes recientes
not me emoticon
@Asmaa asked for this!

Actually I asked her code...my mistake I didn't see it did't come from her!
thumbnail
William Gosse, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Master Mensajes: 533 Fecha de incorporación: 4/07/10 Mensajes recientes
Sorry I thought you were asking for me
Lionel mourad, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensaje: 1 Fecha de incorporación: 25/08/17 Mensajes recientes
Me too,i did the same than you,i copied this code to my navigation.ftl file,i see the search portlet in my page
But,i can make the search only when i logged in,i didn't make it as guest user,
I don't knew what i have to do,can it be a configuration problem ?
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
You just need to wrap it in an conditional statement that checks if the user is signed in.

&lt;#if is_signed_in&gt;
	&lt;#-- your signed in markup/logic here --&gt;
<!--#if-->
thumbnail
Joshua Turner, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensajes: 2 Fecha de incorporación: 11/08/15 Mensajes recientes
I can add it to the page through the portal_normal file, but the controls are completely disabled. You can't type in the search field or click the search button.

Interestingly, when I remove it from the portal_normal file, I can't use the control menu to add one to the page either. It acts as if it's already on the page elsewhere.
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Strange, That almost sounds like you have a "layer" that is over top of the search field (maybe a z-indexed element whose dimensions are overlapping the portlet?)
Eugene Motolov, modificado hace 5 años.

RE: How to add the search portlet to a Liferay 7 theme

New Member Mensajes: 14 Fecha de incorporación: 24/01/18 Mensajes recientes
Can someone tell me how to add the language selector portlet to a Liferay 7 theme. It's has to be simular to this <@liferay.search/> something like <@liferay.language_selector /> but it's not, please help me.
thumbnail
Andrew Jardine, modificado hace 5 años.

RE: How to add the search portlet to a Liferay 7 theme

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Eugene,

Can you try -- <@liferay.languages /> -- looking at the macros that come out of the box, I think that should do what you need, but if it doesn't, let me know.