Forums de discussion

How to add the search portlet to a Liferay 7 theme

thumbnail
William Gosse, modifié il y a 7 années.

How to add the search portlet to a Liferay 7 theme

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
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, modifié il y a 7 années.

RE: How to add the search portlet to a Liferay 7 theme (Réponse)

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
I finally figured this out :
<@liferay.search/>

Its a freemarker macros similar to how a the breadcumb portlet is added.
thumbnail
John Arguedas, modifié il y a 7 années.

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

New Member Publications: 5 Date d'inscription: 30/08/16 Publications récentes
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, modifié il y a 7 années.

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

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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, modifié il y a 7 années.

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

New Member Publications: 5 Date d'inscription: 30/08/16 Publications récentes
Thanks for your time. I am looking for functions like:
<@liferay.breadcrumbs />
<@liferay.control_menu />
<@liferay.search/>
...
thumbnail
Andrew Jardine, modifié il y a 7 années.

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

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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, modifié il y a 7 années.

RE: How to add the search portlet to a Liferay 7 theme (Réponse)

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
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>

Pièces jointes:

Asmaa Chadouli, modifié il y a 6 années.

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

New Member Publications: 2 Date d'inscription: 30/08/17 Publications récentes
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, modifié il y a 6 années.

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

Regular Member Publications: 210 Date d'inscription: 27/12/16 Publications récentes
Hi Asmaa,

could you please paste all your navigation.ftl code?
thumbnail
William Gosse, modifié il y a 6 années.

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

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
See attached file.

Pièces jointes:

thumbnail
Massimo Bevilacqua, modifié il y a 6 années.

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

Regular Member Publications: 210 Date d'inscription: 27/12/16 Publications récentes
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, modifié il y a 6 années.

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

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
That's what you wanted right?
thumbnail
Massimo Bevilacqua, modifié il y a 6 années.

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

Regular Member Publications: 210 Date d'inscription: 27/12/16 Publications récentes
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, modifié il y a 6 années.

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

Liferay Master Publications: 533 Date d'inscription: 04/07/10 Publications récentes
Sorry I thought you were asking for me
Lionel mourad, modifié il y a 6 années.

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

New Member Envoyer: 1 Date d'inscription: 25/08/17 Publications récentes
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, modifié il y a 6 années.

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

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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, modifié il y a 6 années.

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

New Member Publications: 2 Date d'inscription: 11/08/15 Publications récentes
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, modifié il y a 6 années.

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

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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, modifié il y a 5 années.

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

New Member Publications: 14 Date d'inscription: 24/01/18 Publications récentes
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, modifié il y a 5 années.

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

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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.