Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
Robzilla Wrote:...Please provide me support with php-code "ready 2 paste" - i'm so a php-noOob.
:-)
Well here you go Mr Zilla:

Firstly change the current php code you've got for the search results to this:

Code:
<?php get_i18n_search_results(array('tags'=>'news', 'max'=>3,'showLanguage'=>0, 'showDate'=>0, 'numWords'=>10,'HEADER'=>null, 'component'=>'display_news')); ?>
Then create a new component called 'display_news', paste the following code in it and save your components:

Code:
<h3 class="search-entry-title">
  <?php if ($showLanguage) { ?>
  <span class="search-entry-language">
    <?php echo htmlspecialchars($item->language, ENT_NOQUOTES); ?>
  </span>
  <?php } ?>
  <a href="<?php echo $item->link; ?>">
    <?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
  </a>
</h3>
<?php if ($showDate) { ?>
<div class="search-entry-date">
  <?php echo strftime($dateFormat, $item->pubDate); ?>
</div>
<?php } ?>
<div class="search-entry-excerpt">
  <?php echo $item->getExcerpt($item->content, $numWords); ?>
  <div>[<a href="<?php echo $item->link; ?>">more</a>]</div>
</div>

Look to mvlcek's custom results rendering example for more, but that should give you your [more] link. You can edit your display_news component to output the results to whatever you wish to. Making numWords subjected to letter count is beyond my scope however (but if you want you can restrict it by paragraphs by using 'numWords'=>Np where N is the number of paragraphs) so accept my apologies for being unable to help you with that. Hope this is your solution!
Reply
Dear Sir Angryboy,

thank you very much! That's it. Works like a charm.
:-)

Really nice support here!

Unfortunately i'm back agaein with another "error". I use the code above ^ to include my newsticker in header on all sites. On a "i18n search" page with this code:

Code:
(% searchform addtags=_special_foo %)

(% searchresults tags:"foo" lang:de numWords:-1 order:reverseurl HEADER: %)

(% searchrss title="FOO - RSS Feed" name="foo-in" tags:"foo" lang:de numWords:30 %)

...the newsticker displays:
Quote:Keine Ergebnisse gefunden (No search results found)
...when clicking the search button. The search results from the form are all well.
:-(

Coul'd anyone please help me to "split" the newsticker (search results) from the searchform (search results)?

Kind regards,
Rob
Reply
Sorry that I can't help you with that problem there. It's one I've never realised was in the plugin itself, so we'll need to ask mvlcek if he can include a fix for it in the next update (whenever that may be).

@mvlcek (in case the request is misunderstood): Rob has asked for the ability to link a specific 'searchresults' placeholder/code to one or more 'searchform(s)' so that any existing placements of i18n Search are unaffected by use of the search form. Perhaps this could be solved by giving the option of providing an id for the search form which correlates to the results, e.g

Code:
(% searchform id=search %)
(% searchresults id=search %)
Code:
<!--news results shown in the header-->
<div class="header"><?php get_i18n_search_results(array('id'=>'news')); ?></div>

So when a the form is used on that page, only the searchresults with the id search is affected, and the other(s) still output(s) the results shown from before (i.e. the header still shows the news results, unaffected by the search made by the form).
Reply
@Robzilla, @Angryboy:

If you have a search result call in the template, just make sure to specify tags and words, then the results will not be influenced by form parameters, e.g.:
Code:
<?php get_i18n_search_results(array('tags'=>'news', 'words'=>' ', ...)); ?>
(The words parameter is one or more blanks, which is thus not empty, but still contains no words)

@Robzilla: all search calls (searchform, searchresults, searchrss) should have the same search parameters (tags, addtags, words, addwords):

tags specifies the keywords to use, while addtags specifies the tags to add to those given by the user.
If in you example you show the tag cloud and the user selected a tag (-> tags parameter), it would be ignored in the results, as the tags are already set.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Once again I stand corrected :-) Thanks again, mvlcek.

@Robzilla: after the

Code:
'tags'=>'news',

in your search form's PHP coding, paste

Code:
'words'=>' ',

as mvlcek said and your problem should be solved (I've tested it also to see if it works, and it did).
Reply
YOU ROCK!!!
Works well now.

Thx,
Rob
:-)
Reply
Sorry guys, but there is one little bug / error left and i can't figure out how to solve this issue.
:-(

This code in template header (calling component "newsticker"):
Code:
<?php get_i18n_search_results(array('tags'=>'news', 'words'=>' ', 'max'=>3,'showLanguage'=>0, 'showDate'=>0, 'numWords'=>8,'HEADER'=>null, 'component'=>newsticker)); ?>

This one as component "newsticker":
Code:
<h3 class="search-entry-title">
  <?php if ($showLanguage) { ?>
  <span class="search-entry-language">
    <?php echo htmlspecialchars($item->language, ENT_NOQUOTES); ?>
  </span>
  <?php } ?>
  <a href="<?php echo $item->link; ?>">
    <?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
  </a>
</h3>
<div class="search-entry-excerpt">
  <?php echo $item->getExcerpt($item->content, $numWords); ?>&nbsp;[<a class="readmore" href="<?php echo $item->link; ?>">mehr</a>]
</div>

And that in site "foo" content:
Code:
(% searchform addtags=_special_foo %)

(% searchresults tags:"foo" lang:de numWords:-1 order:reverseurl HEADER: %)

(% searchrss title="GREAT FOO - RSS Food" name="foo-in" tags:"foo" lang:de numWords:30 %)

...also this one on another site called "news":
Code:
(% searchresults tags:"news" lang:de numWords:-1 order:reverseurl HEADER: %)

Behavior: If i click on the bottom "newsticker-pagination" (< << 1,2,3,4,5 >> >)
Code:
span class="search-results-paging"
... i get the message:
Quote:Keine Ergebnisse gefunden (No search results found)
... in site content of "news" and "foo" (the sites mentioned above).

If this one is solved - everything works how it should. It woul'd be great if anyone can give me a little help, maybe others can benefit from my support-request / your answers too.

Regards & Thanks in advance,
Rob
:-)
Reply
I18N Search version 2.6.1
  • fixes paging, if search results are displayed in the template (@Robzilla)

Basically you can't use paging for search results embedded in the template.
Rather add a more link below these results leading to a page displaying more results (and offering paging), e.g.

Template:
Code:
...
<?php get_i18n_search_results(array('tags'=>'news', 'words'=>' ', 'max'=>3, 'numWords'=>8, 'HEADER'=>null)); ?>
<a href="<?php find_url('news'); ?>">More news...</a>
...
Content of page news:
Code:
...
(% searchresults tags=news numWords="1p" max=10 showPaging=1 %)
...
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
this is great! - i was just about to post on this issue, because of the scenario where one might be using i18n Search to display a blog listing, and then in the sidebar, the results of some other search; when you page in the blog listing, the other results were also paging.. but it is now fixed in this update!

in my instance, i am using special pages to output 2 different special page search results on the same page; the blog listing is in the left column, and then i created a special page type called widgets, of which the results (widgets) are being displayed in the sidebar...

...which brings up my next questions since these are all 'widgets' i'm trying to create:

1.) how would one create a clickable tag cloud, using i18n search, for a specific special page type, in this case the blog..
EDIT: i found my notes for this...and this is the code (for anyone else needing it):
Code:
<?php get_i18n_tags(array('slug'=>'search')); ?>

2.) any ideas on how to do a popular posts listing? I'm guessing there is some way to access the hitcount data and setup something like this..

3.) for Special Pages Blog - is there any easy/ quick way to setup an archive listing by month/year...

thanks again!

-marc
Reply
I18N Search version 2.7:
  • supports language specific tags (you can also specify in the settings what should happen, if there are no language specific tags, or that only the tags of the default language should be used)
  • better support for language specific search (e.g. parameter lang=de): only tags and words of this language (or more exactly: on pages of this language) are displayed/suggested
  • new parameter PLACEHOLDER to specify a HTML5 placeholder attribute for the search input field (@alienee2)
  • new parameter idPrefix: generates numbered ids for search items <li> with this prefix (@alienee2)
  • new parameter tagClassPrefix: adds the items' tags as classes (with this prefix) to the search items <li> - can be used for styling e.g. special pages with tags _special_news (@alienee2)
  • you can specify the excerpt length in characters, e.g. wordCount=50cm (50 characters with ... for more) (@Robzilla) - I should probably allow an alternate parameter name like excerptLength ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek, check your inbox.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Martin,

I just installed the i18NSearch 2.7 in a GetSimple 3.1
the language files are uploaded, there is the de.php-file

but it is not read.

In the page of a german website, http://www.lyriktext.de/Suche, you can see that is shows the english text, the button and the results bring english text

it should read german text

in gsconfig.php I set:
Code:
# Set PHP locale
# http://php.net/manual/en/function.setlocale.php
setlocale(LC_ALL, 'de_DE');
$LANG = 'de_DE';

what to do?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:I just installed the i18NSearch 2.7 in a GetSimple 3.1
the language files are uploaded, there is the de.php-file
but it is not read.

If you use the I18N plugin, you have to set the default language on Pages/View All Pages (I18N).
Otherwise you need to set $LANG in gsconfig.php.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:
diem Wrote:I suppose you are referring to these lines of code:

Code:
# filter search results (vetoed items are removed from results)
#  - parameters: $item (of type I18nSearchResultItem or I18nSearchResultPage)
#  - must return true, if item should not be included in search results
define('I18N_FILTER_VETO_SEARCH_ITEM', 'search-veto');

As I am no PHP literate, I would greatly appreciate it if you could provide some more info regarding excluding specific pages. Thanks in advance and sorry for the trouble...

Currently there is no way doing it without PHP. You have to create a plugin as described in the Wiki, add a filter with the name 'search-veto' and implement your filter function based on the information you get from the parameter of class I18nSearchResultItem (see /plugins/i18n_search/searcher.class.php).


Hi Martin,

Search result is showing content from protected pages by plugin 'Front-End User Login'.
So i've add the following filter to an existing custom plugin: add_filter('search-veto','show_result');
But now I'm stuck: what to check for in the 'show_result' function? Must I read the XML again or is this fields already in a var? The XML in protected page is:
<memberonly><![CDATA[yes]]></memberonly>
Reply
Rene Wrote:Search result is showing content from protected pages by plugin 'Front-End User Login'.
So i've add the following filter to an existing custom plugin: add_filter('search-veto','show_result');
But now I'm stuck: what to check for in the 'show_result' function? Must I read the XML again or is this fields already in a var? The XML in protected page is:
<memberonly><![CDATA[yes]]></memberonly>

Try the following:
Code:
function show_result($item) {
  $memberonly = (string) $item->memberonly;
  return $memberonly == 'yes';
}
However, I'd rename the function to e.g. feu_veto_search_result, as it should return true, if the result is not shown.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Awesome, your reactions are just as quickly and professional as your plug-ins. I couldn't place the $item parameter right and renamed the function (was a test). Thx
Reply
(Someone speak spanish? I don't speak english, I'm learning, sorry)

Instale los plugins de ''News Manager'' para los nuevos posts y ''Calendar'' para eventos.

News Manager crea un folder en: data/posts
Calendar: /data/other/calendar

Como hacer que I18N Search muestre esos datos en sus resultados?
Solo muestra /data/pages/

Alguna solucion? Gracias...

--------------------------------
...English. (Sorry for my english)
--------------------------------

I installed ''News Manager'' for new posts and ''Calendar'' for events.

News Manager creates a folder in: data / posts
Calendar: / data / other / calendar

How to make I18N Search these data show the results?
Only show / data / pages /

Any solution? Thank you ...
I speak spanish, sorry for my english. I'm learning english with GetSimple too... LOL!

.
Reply
volaverunt Wrote:I installed ''News Manager'' for new posts and ''Calendar'' for events.

News Manager creates a folder in: data / posts
Calendar: / data / other / calendar

How to make I18N Search these data show the results?
Only show / data / pages /

Please ask this question in the "News Manager" thread.
Out-of-the-box I18N Search only searches pages, but can be enhanced easily by other plugins (e.g. I18N Gallery plugin, I18N Special Pages plugin). I think some users of News Manager have already extended it!?

Por favor, pregunta esto en la topic "News Manager" thread.
Es possible extender I18N Search, que News estan buscado.
Creo que algunos usuarios de News Manager hacían esto, pero no estoy seguro.

I hope, my spanish is understandable ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:
volaverunt Wrote:I installed ''News Manager'' for new posts and ''Calendar'' for events.

News Manager creates a folder in: data / posts
Calendar: / data / other / calendar

How to make I18N Search these data show the results?
Only show / data / pages /

Please ask this question in the "News Manager" thread.
Out-of-the-box I18N Search only searches pages, but can be enhanced easily by other plugins (e.g. I18N Gallery plugin, I18N Special Pages plugin). I think some users of News Manager have already extended it!?

Por favor, pregunta esto en la topic "News Manager" thread.
Es possible extender I18N Search, que News estan buscado.
Creo que algunos usuarios de News Manager hacían esto, pero no estoy seguro.

I hope, my spanish is understandable ;-)

....
Ok, but my question maybe is not clear, is for this plugin...

Can search all pages inside the data folder (Post, events, news)?
Because I18N only search inside of pages folder, right? And many plugins create a folder for their exclusives files.

Thank you. Sorry for my bad english.
I speak spanish, sorry for my english. I'm learning english with GetSimple too... LOL!

.
Reply
volaverunt Wrote:Can search all pages inside the data folder (Post, events, news)?
Because I18N only search inside of pages folder, right? And many plugins create a folder for their exclusives files.

If a plugin passes its data (e.g. the text of posts, events, news) to the I18N Search plugin during indexing and also tells it, how to display the data, then I18N Search will also find these items - and in this case it does not matter in which folder the data is.
Otherwise it only searches the text and tags of pages.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:If a plugin passes its data (e.g. the text of posts, events, news) to the I18N Search plugin during indexing and also tells it, how to display the data, then I18N Search will also find these items.
Otherwise it only searches the text and tags of pages.

Ok, I understand.... Well, my last question. I can do that? Or that is a possibility just for the plugin's author?

I give up... Thanks for your help. Anyway, this is a great plugin. See you!
I speak spanish, sorry for my english. I'm learning english with GetSimple too... LOL!

.
Reply
volaverunt Wrote:Ok, I understand.... Well, my last question. I can do that? Or that is a possibility just for the plugin's author?

I give up... Thanks for your help. Anyway, this is a great plugin. See you!

It should be done by the plugin's author.
See this post (and ask @geroyche) for a solution.
Doesn't seem to have been included into News Manager yet.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:It should be done by the plugin's author.
See this post (and ask @geroyche) for a solution.
Doesn't seem to have been included into News Manager yet.

It's working!!! But, the content doesn't show up, only the title, any solution?... Thank You! And Thank you @geroyche!
I speak spanish, sorry for my english. I'm learning english with GetSimple too... LOL!

.
Reply
volaverunt Wrote:It's working!!! But, the content doesn't show up, only the title, any solution?

If you look at the code you see that null is returned for the content.
I suppose, replacing this with the following will work:
Code:
case 'content': return htmlspecialchars_decode($post->content);
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:If you look at the code you see that null is returned for the content.
I suppose, replacing this with the following will work:
Code:
case 'content': return htmlspecialchars_decode($post->content);

Great! Thank you @mvlcek, you are amazing... Reputation +.
I speak spanish, sorry for my english. I'm learning english with GetSimple too... LOL!

.
Reply




Users browsing this thread: 3 Guest(s)