GetSimple Support Forum
Search plugin (I18N) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Search plugin (I18N) (/showthread.php?tid=1256)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29


RE: Search plugin (I18N) - lnickel - 2013-08-26

(2013-08-26, 11:21:38)ReBo Wrote: Hello All,

I'm using GetSimple now for a couple of days and i'm trying to use het Search I18N plugin. Works very good.
But still have a question. I want the search field in the right top of my page instead of the sidebar. Is this possible if yes how?

Regards

Create a page call it whatever you like. Mine is search results. Drop the code immediately below into the editor and save. Take the slug and add it into the last section of the php code below and volia'

(% searchform %) (% searchresults i18n=0 %)

Take the code below and drop it into your header file or whatever file will show the top presumable it would be in the header area.

PHP Code:
<?php get_i18n_search_form(array('slug'=>'search-results')); ?>

You can style it from there. Was that confusing? Smile Lemme know if you need more help.


RE: Search plugin (I18N) - addison - 2013-09-04

I'm using Special Pages along with Search to create item listings like this:

http://www.smgllc.com/our-work/

...where each of those thumbnails represents a Special Pages "page" in GetSimple. I've included those pages as menu items so that I could order by 'menuOrder' like so:

PHP Code:
<?php get_i18n_search_results(array('tags'=>'_special_portfolio-project client''words'=>null'first'=>0'max'=>50'order'=>'+menuOrder''lang'=>null'HEADER'=>null)); ?>[/php 
]

However, the order still seems to be by date. I can re-save any item and it jumps to the first position. Re-sorting the menu has no effect at all. Has anyone else run into this?

Huh


RE: Search plugin (I18N) - addison - 2013-09-04

(2013-09-04, 09:01:27)addison Wrote: I'm using Special Pages along with Search to create item listings like this:

http://www.smgllc.com/our-work/

...where each of those thumbnails represents a Special Pages "page" in GetSimple. I've included those pages as menu items so that I could order by 'menuOrder' like so:

PHP Code:
<?php get_i18n_search_results(array('tags'=>'_special_portfolio-project client''words'=>null'first'=>0'max'=>50'order'=>'+menuOrder''lang'=>null'HEADER'=>null)); ?>[/php 
]

However, the order still seems to be by date. I can re-save any item and it jumps to the first position. Re-sorting the menu has no effect at all. Has anyone else run into this?

Huh

My apologies -- I didn't have the latest version of the Search plugin. It works perfectly. In my defense, GetSimple wasn't showing that it needed updating. Blush


RE: Search plugin (I18N) - boa - 2013-09-14

(2013-08-01, 01:40:22)Angryboy Wrote: Hopefully this is a cleaner and easier to understand way of doing what I mentioned before (again, using return_i18n_search_results, since its purpose is for custom outputs)

PHP Code:
<?php
  
// total number of results
  
$total 5;
  
  
// change parameters (except $max) to ones relevant to your search)
  
$search return_i18n_search_results($tags=null$words=null$first=0$max=999$order=null$lang=null);
  
  
// apply this function as many times as you want to throughly shuffle the results
  
shuffle($search['results']);
  
  
// now limit the results to the max number
  
$search['results'] = array_slice($search['results'], 0$total);
  
  
// loop through each result and output as desired
  
foreach ($search['results'] as $result) {
    
// output
  
}
?>
This does not work, but it works:
PHP Code:
<?php
$total 
get_i18n_search_results(array('tags'=>'Charging_for_the_tail''DATE_FORMAT'=>'''max'=>12,'i18n'=>0'lang'=>'ru''numWords'=>null,'order'=>null,'HEADER'=>null), range(1,999));
shuffle($total);
foreach (
$total as $tot) {
    echo 
"$tot ";
}
?>
Thanks for the line of thought Smile


RE: Search plugin (I18N) - phpman - 2013-09-14

Hello,

i have a problem with the search plugin. If install it and i type any word into the search field eg "contact" and there is this word exist i get allways the result "We are sorry, but the page you are looking for does not exist."

Whats wrong and what i must configure to get a successfull result for my seach ?

Hope anyone can help me

best regards,
Harald


RE: Search plugin (I18N) - Carlos - 2013-09-15

Usage: http://mvlcek.bplaced.net/get-simple/i18nsearch/


RE: Search plugin (I18N) - Kolyok - 2013-10-11

Hello guys.
I've been working on a website/template and i noticed that the plugin uses the jQuery Autocomplete that is deprecated so it causes some problems if you use latest jquery without jQuery migrate.
I would like to suggest the author to change to jQuery UI or update the jQuery Autocomplete with a more up-to-date version.
You can find a working and "maintained" version at https://github.com/dyve/jquery-autocomplete (suggested by the bassistance guy)

Edit: I thought i would share the file im using right now (works with any jquery version) so here it is (extract it into "plugins/i18n_search/js/"):
[attachment=285]


RE: Search plugin (I18N) - cdugdale - 2013-10-16

Hi, first, thank you for this powerful plugin, it's allowed me to create a site how i wanted without having to code it all myself!

TLDR; how can I arrange tags in the tags parameter to perform an 'or' search?

full question for context:
i have been using the I18N search plug in to pull pages onto an aggregate page. this works really well for one tag, but i can't work out how to use it to pull in pages from two places. Essentially i want to perform an or search, but however i try to structure the tags part it is not working.

so for my 'coding' aggregate page to pull in articles tagged with 'code' i use this:
Code:
(% searchresults tags:code numWords:50 max:5 showDate:0 showLanguage:0 HEADER: %)
and it works fine with one tag

What i want to acheive is to pull in articles tagged with 'code' OR 'apps' OR 'other_term_in_here' to pul all articles onto my front page. I tried as below (amongst many others!) but it performs an 'and' search.
Code:
(% searchresults tags:"code apps" numWords:50 max:5 showDate:0 showLanguage:0 HEADER: %)

Any help would be great,

Thank you.


RE: Search plugin (I18N) - mvlcek - 2013-10-17

(2013-10-16, 17:24:04)cdugdale Wrote: TLDR; how can I arrange tags in the tags parameter to perform an 'or' search?
Thank you.

The plugin only supports search for all conditions, i.e. like AND.
However, you can use two search results like:
Code:
(% searchresults tags=code ... %)
(% searchresults tags=apps HEADER='' ... %)
(of course you shouldn't use paging then)


RE: Search plugin (I18N) - cdugdale - 2013-10-17

Hi Mvlcek,

Thanks for your response. that would explain why it wouldn't work then! i thought I had missed something.

I will try what you suggested, i was hoping to get them all sorted by date newest to oldest. I think i'll also try adding a mutual tag to each of the pages that i want to show on the front page, eg 'article' and pull in pages that have that tag, see if that works ok.

Thanks again,

Chris.


RE: Search plugin (I18N) - boa - 2013-10-21

How to display tags only one page?


RE: Search plugin (I18N) - 0zz - 2013-10-26

Please, can you provide me with instructions on what piece of code should i change to get pagination listed to fit this example:
Code:
<div class="pagination pagination-centered">
  <ul>
    <li class="disabled"><a href="#">&laquo;</a></li>
    <li class="active"><a href="#">1</a></li>
    <li><a href="#">2</a></li>
    <li><a href="#">3</a></li>
    <li><a href="#">4</a></li>
    <li><a href="#">&raquo;</a></li>
  </ul>
</div>

This code relates to Bootstap framework which i've adopted for my website in GS..
thank you!


RE: Search plugin (I18N) - lnickel - 2013-10-26

Sorry to bother!!!

Is it possible to use the search to search the news manager archives?

If so, can someone direct in a way to use it?

Currently, I have a special page that prints out the nm_archives.

Many thanks!!!

Lance


RE: Search plugin (I18N) - Carlos - 2013-10-26

(2013-10-26, 04:41:55)lnickel Wrote: Is it possible to use the search to search the news manager archives?

It is, but someone has to develop a plugin to do it, or I'll do it when I have the time to play with this:
Quote:Version 2.0+ supports indexing of custom fields (see I18N Custom Fields) and of other non-page data (plugin developers: see attached example plugin - i18n_search_dummy.zip).
(from mvlcek's 1st post in this thread)


RE: Search plugin (I18N) - lnickel - 2013-10-26

oooh thank you!!!


RE: Search plugin (I18N) - moonspider - 2013-11-08

Hi everyone!
I need a help with this great plugin.

I have a set of pages with numeric slugs like 1, 2, 3 etc. Each has a duplicate in a different language, e.g 1_lng, 2_lng, etc. All of them tagged as 'story'.

So I'm trying to add a custom code in my template's sidebar to show the latest 15 pages of this tag and their creation date.

Here's the code:
PHP Code:
    $listnum 0;
$sidelists return_i18n_search_results('story');
foreach (
$sidelists['results'] as $sidelist) {
if (
$listnum==15) break;
echo 
strftime("%Y/%m/%d"$sidelist->creDate), " - <a href=\""$sidelist->url"\">"$sidelist->title"</a><br />";
$listnum++;
if (
$listnum == 15) {
echo 
"<h3><a href=\""get_site_url(), "news\">More news</a></h3>"
} } 

It shows a list of english pages if language is set to english (which is default), but if it's the other language it shows all pages from both languages. Undecided What should be added to this code to alter results by current language?

Oh, and also, is there a way to specify how to sort results? Like, if I needed to sort them by title on a separate page.

Blush


RE: Search plugin (I18N) - mvlcek - 2013-11-08

(2013-11-08, 22:16:57)moonspider Wrote: ...
So I'm trying to add a custom code in my template's sidebar to show the latest 15 pages of this tag and their creation date.
...
It shows a list of english pages if language is set to english (which is default), but if it's the other language it shows all pages from both languages. Undecided What should be added to this code to alter results by current language?

Oh, and also, is there a way to specify how to sort results? Like, if I needed to sort them by title on a separate page.

See API and description on settings page.
Code:
$sidelists = return_i18n_search_results('story', null, 0, 15, 'title', 'de');
This assumes german as second language. By default all entries in the default language (english) are also displayed.
Sorting by title should work, although it is undocumented (except in some forum posts) and might have problems with encoded entities.


RE: Search plugin (I18N) - moonspider - 2013-11-09

(2013-11-08, 23:52:15)mvlcek Wrote:
Code:
$sidelists = return_i18n_search_results('story', null, 0, 15, 'title', 'de');
This assumes german as second language. By default all entries in the default language (english) are also displayed.
Sorting by title should work, although it is undocumented (except in some forum posts) and might have problems with encoded entities.

tried that, it didn't work at first. showed only pages in language #2, titles didn't change when I switched back to english, even though links lead to right pages within the current locale.

so i was thinking if there was a better way. like, grab language code directly from the page. and i made this tiny language indicator which i passed to your function:

PHP Code:
$langind null;
if (
$language == 'lng1') {
$langind 'lng1'; }
else {
$langind 'lng2'; }

//and then what i posted above with the suggested change:
$sidelists return_i18n_search_results('story'null015'reverseurl'$langind);
//... and the rest 

and now it works properly in every language, yay Smile
i hope this code is alright?
because i'm a total php newb, i didn't know a thing about it 2 weeks ago x)


RE: Search plugin (I18N) - mvlcek - 2013-11-09

(2013-11-09, 02:25:11)moonspider Wrote: tried that, it didn't work at first. showed only pages in language #2, titles didn't change when I switched back to english, even though links lead to right pages within the current locale.

so i was thinking if there was a better way. like, grab language code directly from the page. and i made this tiny language indicator which i passed to your function:

PHP Code:
$langind null;
if (
$language == 'lng1') {
$langind 'lng1'; }
else {
$langind 'lng2'; }

//and then what i posted above with the suggested change:
$sidelists return_i18n_search_results('story'null015'reverseurl'$langind);
//... and the rest 

and now it works properly in every language, yay Smile
i hope this code is alright?

Or much shorter:
Code:
$sidelists = return_i18n_search_results('story', null, 0, 15, 'reverseurl', $language);



RE: Search plugin (I18N) - moonspider - 2013-11-09

wow, definitely shorter.
thank you, mvlcek Smile


RE: Search plugin (I18N) - AliAbabwa - 2013-11-12

(2011-01-23, 03:47:19)mvlcek Wrote: Update: INVALID as of version 1.0

The I18N Search plugin now provides functions to display all tags in a size proportional to their frequency. For a enhanced search where the user can select tags, include the following in your template or (with the DynPages plugin) a component:

Code:
<form action="<?php echo find_url('search', null); ?>">
  <div class="tags"><?php get_i18n_tags(60,250); ?></div>
  <input type="hidden" name="tags" value="<?php echo htmlspecialchars(@$_REQUEST['tags'])?>"/>
  <input type="text" name="words" value="<?php echo htmlspecialchars(@$_REQUEST['words'])?>"/>
  <input type="submit" name="search" value="Go" />
</form>
<script type="text/javascript">
  $(function() {
    $('.tags .tag').click(function(e) {
      $(e.target).toggleClass('selected');
      var tags = ''
      $('.tags .tag.selected').each(function() { tags += ' '+$(this).text(); });
      $('[name=tags]').val(tags);
    });
    var tags = $('[name=tags]').val().split(' ');
    $('.tags .tag').each(function() {
      if ($.inArray($(this).text(),tags) >= 0) $(this).addClass('selected');
    });
  })
</script>
<br />
<?php
  if (isset($_REQUEST['search'])) {
?>
<h2>Search Results</h2>
<?php  
    get_i18n_search_results(null, null, 'No results found' , 'l, F jS, Y - g:i A', 10, 30);
  }
?>

An example can be found on http://mvlcek.bplaced.net/search

I make component "search" with this code and include it in to search page: {% search %}
http://sc-racing.ru/search/
But I can't select the tags like your example http://mvlcek.bplaced.net/search


RE: Search plugin (I18N) - mvlcek - 2013-11-13

(2013-11-12, 23:36:26)AliAbabwa Wrote:
(2011-01-23, 03:47:19)mvlcek Wrote: Update: INVALID as of version 1.0

The I18N Search plugin now provides functions to display all tags in a size proportional to their frequency.
...

I make component "search" with this code and include it in to search page: {% search %}
http://sc-racing.ru/search/
But I can't select the tags like your example http://mvlcek.bplaced.net/search

As you can see at the top of the quoted post, this code is invalid since version 1.0 of the Search plugin.

Just add (% searchform %) to your page and make sure you have enabled "Show tag cloud" in the I18N Search Settings (Tab Plugins).


RE: Search plugin (I18N) - AliAbabwa - 2013-11-13

(2011-01-23, 03:47:19)mvlcek Wrote: Update: INVALID as of version 1.0

The I18N Search plugin now provides functions to display all tags in a size proportional to their frequency. For a enhanced search where the user can select tags, include the following in your template or (with the DynPages plugin) a component:

Code:
<form action="<?php echo find_url('search', null); ?>">
  <div class="tags"><?php get_i18n_tags(60,250); ?></div>
  <input type="hidden" name="tags" value="<?php echo htmlspecialchars(@$_REQUEST['tags'])?>"/>
  <input type="text" name="words" value="<?php echo htmlspecialchars(@$_REQUEST['words'])?>"/>
  <input type="submit" name="search" value="Go" />
</form>
<script type="text/javascript">
  $(function() {
    $('.tags .tag').click(function(e) {
      $(e.target).toggleClass('selected');
      var tags = ''
      $('.tags .tag.selected').each(function() { tags += ' '+$(this).text(); });
      $('[name=tags]').val(tags);
    });
    var tags = $('[name=tags]').val().split(' ');
    $('.tags .tag').each(function() {
      if ($.inArray($(this).text(),tags) >= 0) $(this).addClass('selected');
    });
  })
</script>
<br />
<?php
  if (isset($_REQUEST['search'])) {
?>
<h2>Search Results</h2>
<?php  
    get_i18n_search_results(null, null, 'No results found' , 'l, F jS, Y - g:i A', 10, 30);
  }
?>

An example can be found on http://mvlcek.bplaced.net/search

(2013-11-13, 00:23:57)mvlcek Wrote:
(2013-11-12, 23:36:26)AliAbabwa Wrote:
(2011-01-23, 03:47:19)mvlcek Wrote: Update: INVALID as of version 1.0

The I18N Search plugin now provides functions to display all tags in a size proportional to their frequency.
...

I make component "search" with this code and include it in to search page: {% search %}
http://sc-racing.ru/search/
But I can't select the tags like your example http://mvlcek.bplaced.net/search

As you can see at the top of the quoted post, this code is invalid since version 1.0 of the Search plugin.

Just add (% searchform %) to your page and make sure you have enabled "Show tag cloud" in the I18N Search Settings (Tab Plugins).

Thank's for soon answer, Mvlcek!!
I add (% searchform %) to search page http://sc-racing.ru/search/
and enable "Show tag cloud" in the I18N Search Settings (Tab Plugins).
But tags is still simple text without selecting.
I still can't select the tags like your example
http://mvlcek.bplaced.net/search


RE: Search plugin (I18N) - mvlcek - 2013-11-13

(2013-11-13, 00:57:40)AliAbabwa Wrote: Thank's for soon answer, Mvlcek!!
I add (% searchform %) to search page http://sc-racing.ru/search/
and enable "Show tag cloud" in the I18N Search Settings (Tab Plugins).
But tags is still simple text without selecting.
I still can't select the tags like your example
http://mvlcek.bplaced.net/search

You have to include jQuery (I think a version less than 1.9) in your template for this to work.


RE: Search plugin (I18N) - AliAbabwa - 2013-11-13

(2013-11-13, 02:21:06)mvlcek Wrote:
(2013-11-13, 00:57:40)AliAbabwa Wrote: Thank's for soon answer, Mvlcek!!
I add (% searchform %) to search page http://sc-racing.ru/search/
and enable "Show tag cloud" in the I18N Search Settings (Tab Plugins).
But tags is still simple text without selecting.
I still can't select the tags like your example
http://mvlcek.bplaced.net/search

You have to include jQuery (I think a version less than 1.9) in your template for this to work.
I include jQuery. Look at source code of page http://sc-racing.ru/search/

<script type="text/javascript" src="/plugins/i18n_gallery/js/jquery-1.6.1.min.js"></script>

But still can't select the tags like your example.