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


Search plugin (I18N) - Carlos - 2012-03-04

Spanish language file for I18N Search now available in Extend.


Search plugin (I18N) - Carlos - 2012-03-04

mvlcek Wrote:That's a great idea! It's implemented in
I18N Search version 2.6:
  • a virtual tag _parent_parent-slug is added to the search index

You can list all direct children of a page e.g. products with
Code:
(% searchresults tags=_parent_products %)
or limit a user's search to these pages with
Code:
(% searchform %)
(% searchresults addTags=_parent_products %)

I'm glad you liked the idea. Thanks for adding this!


Search plugin (I18N) - Carlos - 2012-03-04

mvlcek Wrote:
  • adds live search functionality (for an example see here).
This nice new feature might have gone unnoticed because of the following posts.

People, try that example! Awesome...


Search plugin (I18N) - Nobody - 2012-03-20

Hello!
I try I18N Search plugin (in template.php):
Code:
<?php print_r(return_i18n_search_results('news'));?>
and on the page
Code:
Array ( [totalCount] => 1 [first] => 0 [results] => Array ( [0] => I18nSearchResultPage Object ( [data:protected] => [tags:protected] => [title:protected] => [content:protected] => [id:I18nSearchResultItem:private] => bylismy [language:I18nSearchResultItem:private] => [creDate:I18nSearchResultItem:private] => 1332162574 [pubDate:I18nSearchResultItem:private] => 1332162574 [score:I18nSearchResultItem:private] => 1 ) ) )

What I've done wrong?

I have:
GetSimple 3.1
Search (I18N enabled!) 2.6
Custom fields for pages (I18N enabled) 1.8.1


Search plugin (I18N) - mvlcek - 2012-03-20

Nobody Wrote:Hello!
I try I18N Search plugin (in template.php):
Code:
<?php print_r(return_i18n_search_results('news'));?>
and on the page
Code:
Array ( [totalCount] => 1 [first] => 0 [results] => Array ( [0] => I18nSearchResultPage Object ( [data:protected] => [tags:protected] => [title:protected] => [content:protected] => [id:I18nSearchResultItem:private] => bylismy [language:I18nSearchResultItem:private] => [creDate:I18nSearchResultItem:private] => 1332162574 [pubDate:I18nSearchResultItem:private] => 1332162574 [score:I18nSearchResultItem:private] => 1 ) ) )

What I've done wrong?

What do you want to do?
If you want to display the search result, use get_i18n_search_results(...).


Search plugin (I18N) - Nobody - 2012-03-20

I want to display search result, but in my way. I know, I can use CSS, but I need more control.


Search plugin (I18N) - mvlcek - 2012-03-20

Nobody Wrote:I want to display search result, but in my way. I know, I can use CSS, but I need more control.

Then just use the result - you have to actually read the fields, as they are lazy loading.

BTW: it's easier to use custom rendering.


Search plugin (I18N) - Nobody - 2012-03-20

mvlcek Wrote:
Nobody Wrote:I want to display search result, but in my way. I know, I can use CSS, but I need more control.

Then just use the result - you have to actually read the fields, as they are lazy loading.

BTW: it's easier to use custom rendering.
OK, thanks! + to Reputation Smile
But I'm still curious... Function return_i18n_search_results is public. Why return_i18n_search_results returns object with protected or private fields?


Search plugin (I18N) - mvlcek - 2012-03-20

Nobody Wrote:But I'm still curious... Function return_i18n_search_results is public. Why return_i18n_search_results returns object with protected or private fields?

In OO programming you (nearly) never should have public fields.
The "properties" here are accessed through the magic function __get($name), which uses the non-public fields just to "cache" some of the property values.


Search plugin (I18N) - Nobody - 2012-03-20

mvlcek Wrote:The "properties" here are accessed through the magic function __get($name), which uses the non-public fields just to "cache" some of the property values.
And this is what I need Smile Thanks again for all.


Search plugin (I18N) - mvlcek - 2012-03-21

Nobody Wrote:
mvlcek Wrote:The "properties" here are accessed through the magic function __get($name), which uses the non-public fields just to "cache" some of the property values.
And this is what I need Smile Thanks again for all.

Just to make it clear: you don't need to call this function, just use the property names, e.g. here the title:
Code:
$result = return_i18n_search_results('news');
foreach ($result['results'] as $item) {
  echo $item->title;
  ...



Search plugin (I18N) - yojoe - 2012-03-22

I can't figure out how to configure i18n search to work with multilanguage news/blog.
search syntax:
Code:
(% searchresults tags:news_en numWords:30 order:reverseurl HEADER="" DATE_FORMAT:"%d.%m.%Y" %)
Where's the catch I can't find ?


edit: k, didn't notice "lang:XX" in plugin's help.
Now everything works fine.


Search plugin (I18N) - Angryboy - 2012-03-31

Another suggestion:

Code:
(% searchresults order=menu %)

So if a user wants a very specific order for their results that cannot be achieved by any of the previous options, they can set it up using the I18N Navigation Structure configuration.


Search plugin (I18N) - rocket_jump - 2012-04-03

hello All!

how i can put image in search results?

e.g.
i have "news" pages (tag news):
\news1
\news2
\news3
...

in custom fields "image":
image1.jpg (for \news1)
image2.jpg (for \news2)
image3.jpg (for \news3)
...

and page "all news":
with code
<?php
get_i18n_search_results(array('tags'=>'news', 'max'=>5,'showLanguage'=>0, 'showDate'=>0, 'numWords'=>30,'HEADER'=>null));
?>

how i can put image in search results like this?:

[image1][header_news1][text_news1]
...
[imageN][header_newsN][text_newsN]

Thanks in advance!


Search plugin (I18N) - Angryboy - 2012-04-03

Create a custom component with the name 'news-results'. Give it the following coding:

Code:
<h3 class="search-entry-title">
  <img src="<?php echo htmlspecialchars($item->image, ENT_NOQUOTES); ?>">
  <?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>

(mvlcek is responsible for 99% of that code btw)

Then on your news page that is displaying the results, put the following between the php code :

Code:
'component'=>'news-results'

You can meddle with the coding to get it to display exactly as you want, but that should display the image in your results. If you want to add more pieces to the results regarding new customfields, add this into the component where you wish:

Code:
<?php echo htmlspecialchars($item->FIELDNAME, ENT_NOQUOTES); ?>
Replacing FIELDNAME with the name of your field.


Search plugin (I18N) - mvlcek - 2012-04-03

rocket_jump Wrote:how i can put image in search results?

Assuming you have a link to the image in a custom field, you can use custom rendering, see here.

Or use the I18N Special Pages plugin and define your news as special pages - it also supports custom rendering.


Search plugin (I18N) - Carlos - 2012-04-07

@mvlcek

I used hook search-veto in a small plugin I made (to exclude pages with date set in the future from search results).

It works, but: is it the correct way to use this hook? Any suggestions?
Code:
...
add_filter('search-veto','hidefuturepages_search');
...
function hidefuturepages_search($item) {
    return ( intval($item->pubDate) >= intval(strtotime(date('r'))) );
}

Thanks.


Search plugin (I18N) - mvlcek - 2012-04-07

Carlos Wrote:@mvlcek

I used hook search-veto in a small plugin I made (to exclude pages with date set in the future from search results).

It works, but: is it the correct way to use this hook? Any suggestions?

Yes that's correct. It's easy, isn't it?


Search plugin (I18N) - Carlos - 2012-04-08

mvlcek Wrote:It's easy, isn't it?

Yes it is. Really awesome plugin.


Search plugin (I18N) - Carlos - 2012-04-16

Tip to avoid processing of some (% searchresults ... %) tags in tutorials, examples, etc. (so that you don't have to write them like ( % ... % ) and tell to remove the spaces...):

Edit page, switch to html source code mode and enclode opening tags (or one of its characters) within span tags. E.g.:
Code:
<span>(</span>% searchresults ... %)
or:
Code:
<span>(%</span> searchresults ... %)

If you have many (like Angryboy's tutorials) you may prefer to style the span with a class (to make it easier to locate later if you want to change all of them), like:

Code:
<span class="NoTag">(</span>% searchresults ... %)



Search plugin (I18N) - Angryboy - 2012-04-16

Carlos Wrote:Tip to avoid processing of some (% searchresults ... %) tags in tutorials, examples, etc. (so that you don't have to write them like ( % ... % ) and tell to remove the spaces...):

Edit page, switch to html source code mode and enclode opening tags (or one of its characters) within span tags. E.g.:
Code:
<span>(</span>% searchresults ... %)
or:
Code:
<span>(%</span> searchresults ... %)

If you have many (like Angryboy's tutorials) you may prefer to style the span with a class (to make it easier to locate later if you want to change all of them), like:

Code:
<span class="NoTag">(</span>% searchresults ... %)
Genius, Carlos. Genius!


Search plugin (I18N) - alienee2 - 2012-04-19

Re: i18n Search Results - "Raw" output

I am using i18n special pages in combination with i18n search to make a lot of custom content, and then render the 'results' page in certain ways, one of which for example is with a prettybox gallery, of which the gallery image links to the special page...

In order to get the markup to output correctly, i need to have the 'raw' output of the i18n search results for the special pages; i was able to do it fine, by removing lines 63, 67, 105 and 110, from i18n_search/searchresults.php; [those are the lines that output the containing list elements (ul, li, /li, /ul)]

But i am wondering if there is a better way to do this, maybe using a function in the theme folder...?

Or, if there were an additional parameter in the i18n search results code, like
Code:
... 'rawOuput'=>1
which would by default be off, and you could have the results display without the containing list elements, by specifying this parameter; so this wouldn't affect anyone unless they specifically had a need for it...

so this would be used in cases where you want to have total control over the class/id of the list elements, which is very often needed for things like slideshows, prettyphoto galleries, blog listings, carousels, etc..

Thanks again for making these plugins in the first place.. !

-marc


Search plugin (I18N) - mvlcek - 2012-04-19

alienee2 Wrote:Re: i18n Search Results - "Raw" output

...

In order to get the markup to output correctly, i need to have the 'raw' output of the i18n search results for the special pages; i was able to do it fine, by removing lines 63, 67, 105 and 110, from i18n_search/searchresults.php; [those are the lines that output the containing list elements (ul, li, /li, /ul)]

But i am wondering if there is a better way to do this, maybe using a function in the theme folder...?

Or, if there were an additional parameter in the i18n search results code, like
Code:
... 'rawOuput'=>1
which would by default be off, and you could have the results display without the containing list elements, by specifying this parameter; so this wouldn't affect anyone unless they specifically had a need for it...

...

That's an interesting idea, but there are some problems, e.g.:
  • Special Pages intentionally only replaces the content of the <li>, as it must also display in a default search over the whole site, where special pages would be mixed with other special page types and standard pages, which do not have a special render "component"

In most cases I'd say you should be able to render a <ul> exactly as you want, if the page content is contained in a div with the page slug as id or class.

But there might be cases where this is not enough, so I would rather suggest a parameter tagClasses=1 which would add all tags of an indexed item (page) prefixed with tag- as classes into the <li>. This way you could format your search items with CSS depending on the tags (e.g. colorize all items with li.tag-important) or special page types (e.g. li.tag-_special_news for news).


Search plugin (I18N) - alienee2 - 2012-04-19

here's an example of the way i'm outputting my 'portfolio' special page search results:

Code:
<ul id="gallery" class="grid">
<li data-id="lorem-ipsum-16"  class="illustration gridimage">     <a href="/gs31b/data/uploads/portfolio16.jpg"   rel="prettyPhoto[gallery]"    title=""> <img src="/gs31b/data/uploads/portfolio16-th.jpg"  alt="" /></a> </li>
</ul>

so in your scenario, i would adjust the css and js to work with the default id/class of the UL (maybe targeting based on the body class), and then i would be able to specify the LI class with the tag- ; the only other issue is that in this example, prettyphoto needs a unique id in order to work right, for example here, using special pages and the modded search component:
http://dev.propellant23.com/gs31b/index.php?id=portfolio

-marc


Search plugin (I18N) - Robzilla - 2012-04-21

Hello there!

I'm using this code:
Code:
<?php
get_i18n_search_results(array('tags'=>'news', 'max'=>3,'showLanguage'=>0, 'showDate'=>0, 'numWords'=>10,'HEADER'=>null));
?>

... to display a list with news-excerpts in a small "newsticker" div-container.

Here's my problem / question:

Quote:Is there any way to display a "read more" link like [more] instead of (unlinked) "..."?
That would be sheer awesome!!!


The website-template im currently coding has no "text-decorations" on hyperlinks - at least none in the newsticker-box. So the users are going to be confused about "where the f@#*$%& do i have to click on to get to the news?!". This is the reason i want to provide a "read more" link to them. Usabilty benefits too.


Help from the pro's here would be great! :-D
... because i unfortunately have 0 (zero) skills in PHP and stuff like that.

Kind Regards & Thanks in Advance,
Rob
:-)

PS.: Another question i have, is if there is a solution to limit the output by letter-count instead of word-count (numWords)?

Please provide me support with php-code "ready 2 paste" - i'm so a php-noOob.
:-)