Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
I'll try to explain Oleg's problem.

It's an issue with PHP's strftime and the %B placeholder.
In Russian, Polish and I suppose other languages, months names are slightly different if genitive (e.g. in %d %B %Y) or nominative ("%B" or "%B %Y")
But %B will always return either genitive or nominative, depending on the server setup.

As a temporary workaround I made a small plugin (the one that Oleg links) that allows replacing strings (given array) between given start and end strings (to avoid replacing unwanted strings in the content), with an example for News Manager, to change month names returned by stftime, to the ones Oleg needed (genitive, for post dates).

However this doesn't work for him with I18N Search (using the appropriate start/end strings) - I suppose that it's because both my plugin and yours use the content filter, and so it depends on which one is run first.

PS I was thinking about some fix for News Manager (which should use both genitive -post dates- and nominative -archives-), maybe adding support for two months arrays in the language file and replace %B by the correct one depending on the context.
Reply
Oleg, do you use a custom component to display results?
Reply
I use the plugin I18N Special Pages
Reply
I'll reply in the Special Pages thread
Reply
Hi
I have a website for the Town of Cornwall using GetSimple:

http://www.cornwallct.org/minutes/index.php?id=home

Trying to set up search box the same way as seen here on this page, that is listing the past searches by popularity:

http://www.chattanooga.gov/

Is it possible to do with I18N Search ?

I am not very good with PHP, so could you give me a detailed answer if you have one

thanks

Lazlo
Reply
I have a simple question, pretty sure there's got to be an answer for that.

I use return_i18n_search_results in my template for various lists. My pages also have numeric slugs, e.g. 01,02,03, etc.
Being a PHP noob that I am, at first I named everything straightforward with 1,2,3. But then came page 10 and all my search lists reavealed that 10 comes after 1 and not 9. I fixed the problem temporarily by adding a zero to the first 9 pages, but that's only until I get to page 100 Sad

In short, if I use 'reverseurl' and 'url' as $order, is there a way to sort the results in natural order so that 10 comes after 9 etc?

I tried sorting by creDate but that returns results in ascending order, and I sometimes need them descending. Btw, is there a way to do a reverse creDate?
Reply
(2015-08-08, 05:43:55)moonspider Wrote: I have a simple question, pretty sure there's got to be an answer for that.

I use return_i18n_search_results in my template for various lists. My pages also have numeric slugs, e.g. 01,02,03, etc.
Being a PHP noob that I am, at first I named everything straightforward with 1,2,3. But then came page 10 and all my search lists reavealed that 10 comes after 1 and not 9. I fixed the problem temporarily by adding a zero to the first 9 pages, but that's only until I get to page 100 Sad

In short, if I use 'reverseurl' and 'url' as $order, is there a way to sort the results in natural order so that 10 comes after 9 etc?

Not tested: looking at the code it might work if you use 'id' or '-id' as order instead - the url/slug is stored in the id field and when comparing numeric strings, it should sort them numerically.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2015-08-08, 06:05:51)mvlcek Wrote:
(2015-08-08, 05:43:55)moonspider Wrote: I have a simple question, pretty sure there's got to be an answer for that.

I use return_i18n_search_results in my template for various lists. My pages also have numeric slugs, e.g. 01,02,03, etc.
Being a PHP noob that I am, at first I named everything straightforward with 1,2,3. But then came page 10 and all my search lists reavealed that 10 comes after 1 and not 9. I fixed the problem temporarily by adding a zero to the first 9 pages, but that's only until I get to page 100 Sad

In short, if I use 'reverseurl' and 'url' as $order, is there a way to sort the results in natural order so that 10 comes after 9 etc?

Not tested: looking at the code it might work if you use 'id' or '-id' as order instead - the url/slug is stored in the id field and when comparing numeric strings, it should sort them numerically.

Yay, it works! Thank you. '-creDate' works too.
Reply
Hello!
Tell me, you can do so in the settings (% searchresults %) it was possible to specify classes for the tags ul and li?

Thank you!
I use machine translation. Forgive my errors.
Reply
Hi,

what´s are the correct syntax if i like to use I18Nseacht with Read Agency Theme:

Original Theme search are:

<div class="search">
<form role="form">
<input type="text" class="search-form" autocomplete="off" placeholder="Search">
<i class="fa fa-search"></i>
</form>

but if i like to replace this with I18Nsearch syntax like sample from your side it does not show like original one.

Hope anyone can help.

best regards,

Harald
Reply
(2015-08-08, 06:24:05)moonspider Wrote:
(2015-08-08, 06:05:51)mvlcek Wrote:
(2015-08-08, 05:43:55)moonspider Wrote: I have a simple question, pretty sure there's got to be an answer for that.

I use return_i18n_search_results in my template for various lists. My pages also have numeric slugs, e.g. 01,02,03, etc.
Being a PHP noob that I am, at first I named everything straightforward with 1,2,3. But then came page 10 and all my search lists reavealed that 10 comes after 1 and not 9. I fixed the problem temporarily by adding a zero to the first 9 pages, but that's only until I get to page 100 Sad

In short, if I use 'reverseurl' and 'url' as $order, is there a way to sort the results in natural order so that 10 comes after 9 etc?

Not tested: looking at the code it might work if you use 'id' or '-id' as order instead - the url/slug is stored in the id field and when comparing numeric strings, it should sort them numerically.

Yay, it works! Thank you. '-creDate' works too.

well, as you said, it works when comparing numeric strings.
if there are letters preceding numbers (e.g. 'slug1', 'slug2', 'slug10'), it does the usual 1-10-100-2.
just ran into this issue and had to switch from -id to -credate.
Reply
Hi there,

ist there a way to do a search on more than one fields? E. g. search for specialfield_1 = x and specialfield_2 = y.

Alex
Reply
(2015-10-23, 03:37:22)Alexander_ Wrote: Hi there,

ist there a way to do a search on more than one fields? E. g. search for specialfield_1 = x and specialfield_2 = y.

Alex

From the docs:

Quote:Parameters for the search results:
  • tags: Tags (key words) to search for (instead of the submitted tags), separated by blanks. If you have a multi-word tag, replace its blanks with _

Eg, on your page:
Code:
(% searchresults tags=specialfield_1 specialfield_2 %)

In PHP (untested, might need to specify an array for the tags param): 
PHP Code:
<?php 
  $params 
= array('tags' => 'specialfield_1 specialfield_2');
  
get_i18n_search_results($params); ?>
Reply
as far as I understood, this code allows you to exclude tags ul and li from the code search
Code:
<?php
  global $language;
  $result = return_i18n_search_results('_special_news',null,0,20,'+menuOrder',$language);
?>
<div class="row">
    <?php foreach ($result['results'] as $item) { ?>
    <div class="col-md-4">
        <h3><a href="<?php echo $item->link; ?>">
          <?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
        </a></h3>
<?php echo strftime($dateFormat, $item->pubDate); ?>
<?php echo $item->getExcerpt($item->content, $numWords); ?>
    </div>
    <?php } ?>
</div>
please tell me how to configure the number of text excerpts, dates, and pagination
Reply
Code:
<?php
  global $language;
  $result = return_i18n_search_results('_special_news',null,0,2,'+menuOrder',$language);
?>
<div class="row">
    <?php foreach ($result['results'] as $item) { ?>
    <div class="col-md-4">
<div class="blog_element">
        <h4><?php echo htmlspecialchars($item->language, ENT_NOQUOTES); ?> <a href="<?php echo $item->link; ?>">
          <?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
        </a></h4>
<?php echo str_replace(
array("Январь","Февраль","Март", "Апрель","Май","Июнь","Июль","Август","Сентябрь", "Октябрь","Ноябрь","Декабрь"),
array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"), strftime('%d %B %Y', $item->creDate)); ?>
<p><?php echo $item->getExcerpt($item->content, '30'); ?></p><br />
<a href="<?php echo $item->link; ?>" class="read_more">Читать далее...</a>
    </div>
</div>
    <?php } ?>
</div>
I think I figured out, but I want to enable pagination.
Reply
I've been searching for a while for a way to implement the below in a custom component.
Have I over looked a way to have I18N provide the complete page content rather then an excerpt?

I would like to implement a basic blog page that contains all (or paginated) blog entry's of a tag / category on a single page.
The current excerpt appears to strip HTML, where as I would like to also include the formatting and the media from the post without having to duplicate it into a custom field.
If this is not already available how would I get the current search result entry slug so I may use in a custom component
<?php get_page_excerpt(1000, $html); ?>;

The reason why is I have converted a wordpress site to GetSimple and would like to replicate the previous blog entry page layout which showed the full html of the blog entry's in sequence.
Reply
You can use Custom Rendering with a component
http://mvlcek.bplaced.net/get-simple/i18...-rendering
and display the content with, I suppose:
Code:
echo $item->content;
Reply
(2015-11-13, 08:38:16)Carlos Wrote: You can use Custom Rendering with a component
http://mvlcek.bplaced.net/get-simple/i18...-rendering
and display the content with, I suppose:

Code:
echo $item->content;

Thank you AGAIN! Carlos.
I could have sworn when tested before it stripped the html tags. Works as you directed. 
Reply
Something weird happens on my website:
I'm using SpecialPages and Search to display news on the main page. I also want to have a search form in my template.
The code I use to call news:
Code:
<?php get_i18n_search_results(array('tags'=>'news', 'DATE_FORMAT'=>'%d %B, %Y', 'max'=>5, 'i18n'=>0, 'lang'=>'ru', 'numWords'=>'1p', 'order'=>'created', 'showPaging'=>1, 'HEADER'=>'')); ?>

The code I use to call search form:
Code:
<?php get_i18n_search_form (array('slug'=>'search', 'showTags'=>0, 'minTagSize'=>90, 'maxTagSize'=>200, 'GO'=>'Найти', 'PLACEHOLDER'=>'Поиск по сайту')); ?>
And I do have "search" page, where I expect to see search results with this code:
Code:
(% searchform %)
(% searchresults %)

But for some reason, when I try search "something", for example, it states in the address bar:
http://.../?words=something&search=Найти

instead of:
http://.../search/?words=something&search=Найти

So, it does not redirect to the relevant page, and the results are shown instead of news. I'm using latest plugins, and cannot figure out what is causing the problem..
Reply
(2016-02-05, 01:44:23)0zz Wrote: ...

But for some reason, when I try search "something", for example, it states in the address bar:
http://.../?words=something&search=Найти

instead of:
http://.../search/?words=something&search=Найти

What does the generated HTML form look like?
What is your URL pattern?
Any redirects in your .htaccess?
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2016-02-05, 04:22:55)mvlcek Wrote: What does the generated HTML form look like?

Code:
<form action="http://rkvaqt.uz/index.php?id=search" method="POST" class="search">
  <input type="text" name="words" class="search-words" value="something" placeholder="Поиск по сайту"/>
  <input type="submit" name="search" class="search-submit" value="Найти" />
      <script type="text/javascript" src="http://rkvaqt.uz/plugins/i18n_search/js/jquery.autocomplete.min.js"></script>
  <script type="text/javascript">
        $(function () {
      var $live = $('ul.search-results.search-live');
      // add css file
      $('head').append('<link rel="stylesheet" type="text/css" href="http://rkvaqt.uz/plugins/i18n_search/css/jquery.autocomplete.css"></link>');
      $('form.search input[name=words]').autocomplete(
        "http:\/\/rkvaqt.uz\/plugins\/i18n_search\/ajax\/suggest.php?langs=,en", {
        minChars: 1,
        max: 50,
        scroll: true,
        multiple: true,
        multipleSeparator: ' '
      });
          });
  </script>
  </form>

The URL pattern is default and no changes to the default .htaccess

- I tried switching on and off Friendly URLs in AdminPanel - same result.
Reply
(2016-02-05, 15:00:20)0zz Wrote:
Code:
<form action="http://rkvaqt.uz/index.php?id=search" method="POST" class="search">
 <input type="text" name="words" class="search-words" value="something" placeholder="Поиск по сайту"/>
 <input type="submit" name="search" class="search-submit" value="Найти" />
     <script type="text/javascript" src="http://rkvaqt.uz/plugins/i18n_search/js/jquery.autocomplete.min.js"></script>
 <script type="text/javascript">
       $(function () {
     var $live = $('ul.search-results.search-live');
     // add css file
     $('head').append('<link rel="stylesheet" type="text/css" href="http://rkvaqt.uz/plugins/i18n_search/css/jquery.autocomplete.css"></link>');
     $('form.search input[name=words]').autocomplete(
       "http:\/\/rkvaqt.uz\/plugins\/i18n_search\/ajax\/suggest.php?langs=,en", {
       minChars: 1,
       max: 50,
       scroll: true,
       multiple: true,
       multipleSeparator: ' '
     });
         });
 </script>
 </form>

The URL pattern is default and no changes to the default .htaccess

- I tried switching on and off Friendly URLs in AdminPanel - same result.

This information does not match your problem description:
* above form uses POST, but in your description you state that the URL is http://.../?words=something&search=Найти, which is a GET.

Looking at the source of your site, you manually add a form (without action!) and then call get_i18n_search_form inside resulting in
Code:
<form class="navbar-form navbar-right search" role="search">
            <form action="http://rkvaqt.uz/index.php?id=search" method="POST" class="search">
which is invalid HTML and won't work. Remove your additional form!
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
omg! yeah, for some reason I didn't notice that additional form tag - this is a bootstrap theme thing.. Thank you! I'm back to life! ))
Reply
Hi,

@mvlcek very very nice plugin. but any project to make a better navigation ?

Some ideas to improve (perhaps it's already possible but how ?)

1. Actually we have for a page 2 an link towards http://localhost/getsimple/blog/?tags=&words=&search=&page=2
Is it possible to have only http://localhost/getsimple/blog/?page=2 (url which is already active)

2. When we are on page 2 to come back page 1 we have http://localhost/getsimple/blog/?tags=&words=&search=&page=1  is it possible to have only  http://localhost/getsimple/blog/ (to avoid duplicate content for seo between http://localhost/getsimple/blog/?tags=&words=&search=&page=1 et http://localhost/getsimple/blog/)

3. Is it possible to add on the header tag prev and next (cF. https://support.google.com/webmasters/answer/1663744) like this, if we are on page 2 :
<link rel="prev" href="http://localhost/getsimple/blog/" />
<link rel="next" href="http://localhost/getsimple/blog/?page=3" />

Regards,
keep improving

Frédéric
Reply
I18N Search version 2.13:
  • improves the paging links - only necessary parameters are included, the first page does not contain the page parameter (@FrédéricG)

Comment:
  • If the Pagify plugin is installed, I18N Search uses the pagify navigation - it was also updated to not show the page parameter for the first page.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 7 Guest(s)