Foren

How to add the search portlet to a Liferay 7 theme

thumbnail
William Gosse, geändert vor 7 Jahren.

How to add the search portlet to a Liferay 7 theme

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
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, geändert vor 7 Jahren.

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

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
I finally figured this out :
<@liferay.search/>

Its a freemarker macros similar to how a the breadcumb portlet is added.
thumbnail
John Arguedas, geändert vor 7 Jahren.

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

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

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

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

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

New Member Beiträge: 5 Beitrittsdatum: 30.08.16 Neueste Beiträge
Thanks for your time. I am looking for functions like:
<@liferay.breadcrumbs />
<@liferay.control_menu />
<@liferay.search/>
...
thumbnail
Andrew Jardine, geändert vor 7 Jahren.

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

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

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

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
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>
Asmaa Chadouli, geändert vor 6 Jahren.

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

New Member Beiträge: 2 Beitrittsdatum: 30.08.17 Neueste Beiträge
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, geändert vor 6 Jahren.

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

Regular Member Beiträge: 210 Beitrittsdatum: 27.12.16 Neueste Beiträge
Hi Asmaa,

could you please paste all your navigation.ftl code?
thumbnail
William Gosse, geändert vor 6 Jahren.

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

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
See attached file.
thumbnail
Massimo Bevilacqua, geändert vor 6 Jahren.

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

Regular Member Beiträge: 210 Beitrittsdatum: 27.12.16 Neueste Beiträge
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, geändert vor 6 Jahren.

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

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
That's what you wanted right?
thumbnail
Massimo Bevilacqua, geändert vor 6 Jahren.

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

Regular Member Beiträge: 210 Beitrittsdatum: 27.12.16 Neueste Beiträge
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, geändert vor 6 Jahren.

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

Liferay Master Beiträge: 533 Beitrittsdatum: 04.07.10 Neueste Beiträge
Sorry I thought you were asking for me
Lionel mourad, geändert vor 6 Jahren.

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

New Member Beitrag: 1 Beitrittsdatum: 25.08.17 Neueste Beiträge
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, geändert vor 6 Jahren.

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

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

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

New Member Beiträge: 2 Beitrittsdatum: 11.08.15 Neueste Beiträge
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, geändert vor 6 Jahren.

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

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

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

New Member Beiträge: 14 Beitrittsdatum: 24.01.18 Neueste Beiträge
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, geändert vor 5 Jahren.

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

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
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.