#1 2013-02-14 12:25:18

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

[tuto] Howto using module search (multilanguage)

With Ionize 0.9.9 and above, there are simple ways to add an input search in your website.
This is my way :

Thirst of all, install the module search from admin, with a different name than the default one, like : "searching"

In System Menu, add a page "search", and edit the url field for each languages like "recherche" for French, "search" for English...

In static translation, add a term "page-search", and edit the translation for each language. Be careful, this is the term url to call the page search (ex : "search" for english, and "recherche" for french)

Then, now, edit your view wich contain the form search :

<form method="post" action="<ion:home_url /><ion:lang key="page-search" />">
      <input class="search" type="text"  name="realm" value='<ion:lang key="search" />' onblur="if(this.value.length == 0) this.value='<ion:lang key="search" />';" onclick="if(this.value == '<ion:lang key="search" />') this.value='';">
    </form>

This form call the search page for each language

But you can also use the ion tag, which display a default search form

<ion:search:form />

Now, create a view called search.php :

<ion:search>
    <h2><ion:page:title suffix="lang('for')" />"<ion:realm />"</h2>  
  
      <ion:results >       
        <ion:count is="true">
          <ion:result>
            <ion:title tag="h3" />
            <ion:content words="50" />
            <a href="<ion:url />" class="readmore"><ion:lang key="read_complete_article" /></a>
          </ion:result>
        </ion:count>
        
        <ion:count is="false">
            <p><ion:lang key="module_search_message_no_results" /></p>
        </ion:count>
               
      </ion:results>
</ion:search>

Finally, Edit Theme in the backend and declare this view.
Link this declared theme-view for the page called "Search" (System menu). Uncheck "Display in nav" in the panel.

Is it ok for you ?

Last edited by Kink (2013-02-16 10:12:21)


Webmaster / OUF!WEB

Offline

#2 2013-02-14 21:41:50

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [tuto] Howto using module search (multilanguage)

Thanks Kink for this tutorial.
Looks like it is missing in the module doc ! :-)


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#3 2013-02-19 16:33:07

greet
Ion Tester
From: Belgium
Registered: 2012-05-07
Posts: 143

Re: [tuto] Howto using module search (multilanguage)

@kink: Thanks for this tutorial.
I used it exactly as in your tutorial but for some reason, the searchterm (<ion:realm />) is not doing it's job ...
I don't get any results. (I did index the articles -> then used a term from an article -> no results).
Am I missing something?
Greet

Offline

#4 2013-02-19 17:04:16

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

@Greet. Is the search term shown near the title ? If not, there is probably a mistake in the code, or articles are not indexed.


Webmaster / OUF!WEB

Offline

#5 2013-02-19 22:49:07

greet
Ion Tester
From: Belgium
Registered: 2012-05-07
Posts: 143

Re: [tuto] Howto using module search (multilanguage)

Yes, the search term is shown in the title.
I added a few articles and now I get a result. But the first article does not get indexed for some reasen (is article from homepage).
Do you know where the indexed content is stored or how you can check if the article content is indexed? I can't find anything in the tables.
Thx,
Greet

Offline

#6 2013-02-19 23:32:22

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

Is your website multilanguage?  if yes, perhaps the first article is offline for the desired lang ?


Webmaster / OUF!WEB

Offline

#7 2013-02-20 11:59:56

greet
Ion Tester
From: Belgium
Registered: 2012-05-07
Posts: 143

Re: [tuto] Howto using module search (multilanguage)

The website is not multilingual but the article that does not index is the original article when installing ionize. After I deleted this article and made another one everything was fine.
Thx,
Greet

Offline

#8 2013-02-20 14:43:57

gnadirap
Member
From: CH-Ramsen
Registered: 2012-03-27
Posts: 33
Website

Re: [tuto] Howto using module search (multilanguage)

where do i find the module "search" ???

I've nothing like this in my module-administration


---------- Edit --------------

sorry... found it in the module-section

Last edited by gnadirap (2013-02-20 14:47:34)

Offline

#9 2013-06-05 06:01:46

Kha
Member
Registered: 2013-06-05
Posts: 12

Re: [tuto] Howto using module search (multilanguage)

im trying using ionize version 1.0.0..i got problem when followed this tutorial...how to call search form from url?do i need to put  $this->output('search_form'); in the index function in search controller?but it cannot recognize ion term e:g <ion:translation term="module_search_button_start" /> ..

Then, now, edit your view wich contain the form search :

<form method="post" action="<ion:home_url /><ion:lang key="page-search" />">
      <input class="search" type="text"  name="realm" value='<ion:lang key="search" />' onblur="if(this.value.length == 0) this.value='<ion:lang key="search" />';" onclick="if(this.value == '<ion:lang key="search" />') this.value='';">
    </form>

Did Kink means search_form.php in the view folder of Search Module?


Kha

Offline

#10 2013-06-05 09:33:12

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

@Kha, you must declare a view called "Search" in your theme. Read carrefully the howto from the beginning. I don't use the view from de module.
I will test with Ionize 1.00.


Webmaster / OUF!WEB

Offline

#11 2013-06-05 10:30:01

Kha
Member
Registered: 2013-06-05
Posts: 12

Re: [tuto] Howto using module search (multilanguage)

Sorry Kink..im just confused. i already installed module search and named 'searching' and then created search.php file in the theme. i declared it and linked it with 'Search' page (System Menu). I just dont know for this below:

Then, now, edit your view wich contain the form search :

<form method="post" action="<ion:home_url /><ion:lang key="page-search" />">
      <input class="search" type="text"  name="realm" value='<ion:lang key="search" />' onblur="if(this.value.length == 0) this.value='<ion:lang key="search" />';" onclick="if(this.value == '<ion:lang key="search" />') this.value='';">
    </form>

As u said, i need to edit a view which contain the form search, where is this file?Sorry i thought it was in the search module, so i edited the form_search.php in the view. if it not from search module, then where is it? or is it same step with 'search.php' and i just call the page to open search form? is it linked with the tags given in the module.

Last edited by Kha (2013-06-05 10:34:31)


Kha

Offline

#12 2013-06-05 11:11:35

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [tuto] Howto using module search (multilanguage)

Dear Kink, I'm already following your method and this is the search result : Tag missing: search, scope: .

Is search view assign to page or article?

Offline

#13 2013-06-05 11:47:00

GWR
Member
Registered: 2013-02-25
Posts: 125

Re: [tuto] Howto using module search (multilanguage)

Did you correct the config.php of each module (according to the new config.php "demo"-module uses).

Think my modules had that scope error too - until I added the config.php.


bye
Ron

Offline

#14 2013-06-05 12:10:20

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

I made corrections according of the new release of Ionize. I will post a new tuto soon


Webmaster / OUF!WEB

Offline

#15 2013-06-05 12:33:42

Kha
Member
Registered: 2013-06-05
Posts: 12

Re: [tuto] Howto using module search (multilanguage)

Thanks Kink..


Kha

Offline

#16 2013-06-05 12:37:07

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

See this post for the release 1.02 of Ionize : http://ionizecms.com/forum/viewtopic.php?pid=5560#p5560


Webmaster / OUF!WEB

Offline

#17 2013-06-05 15:20:00

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [tuto] Howto using module search (multilanguage)

Wow, it's works kink, thanks a lot

Offline

#18 2013-06-06 06:01:27

Kha
Member
Registered: 2013-06-05
Posts: 12

Re: [tuto] Howto using module search (multilanguage)

Many thanks @Kink for the new tutorial. Now I understand a little about the Ionize's workflow. Thanks again


Kha

Offline

#19 2013-06-06 18:37:22

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

@Kha You're welcome! big_smile


Webmaster / OUF!WEB

Offline

#20 2013-06-08 04:45:12

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [tuto] Howto using module search (multilanguage)

Hi Kink, why the search result always results duplicate?

Offline

#21 2013-11-13 14:10:57

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [tuto] Howto using module search (multilanguage)

@minileaf, check this release of search module : https://github.com/Kink03/ionize-module-search


Webmaster / OUF!WEB

Offline

#22 2014-05-27 23:44:28

sledov
Member
Registered: 2014-04-10
Posts: 4

Re: [tuto] Howto using module search (multilanguage)

Hi, and thank you for the good search. I have 1 question only. If I have 10k results, how can I limit them to 20 (for instance) per page and display <prev | next> on the bottom?

Offline

#23 2017-05-31 02:44:59

damascus
Member
From: Brisbane, Australia
Registered: 2013-04-08
Posts: 270
Website

Re: [tuto] Howto using module search (multilanguage)

@Kink - im also quite interested in adding pagination, updating our site and i want to use the search module, which works alright, however i cant see how to add pagination and not fit for use without it


Webmaster | OneCNC Australia

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations