Phoenix (v1.7 CVS+)
PHP:
$Plugins->call_method( $am_search->ID, 'CorrectSearch'); // (v1.7+)
$Plugins->call_by_code( 'am_search',array() ); // (v1.6)
The "Search Hi-lite" plug-in was originally designed and tested on on a "Phoenix" CVS v1.7 b2evolution install. It is anticipated that it will work with any newer installation, but no other versions are currently available to test. (Hover over the green "information" button, on the left, for information regarding using this plugin with v1.6 "Alpha").
Two Steps to a Better Search
Download and Install the Search Plugin: This is the easy part, because plugins are a one-click operation. Just download the following file:
AstonishMe! Search Plugin
Move the downloaded file to your /plugins folder and make sure that the name of the file is _am_search.plugin.php.
To install, log into your b2evolution administration back office. There, go to SETTINGS -> PLUGINS and you should see "AM! Search Hi-lite" on the list of available plug-ins. Just click the "install" option and BOOM, it's installed. How easy is that?
Modify Your Skin: You will need to edit the main template file (i.e., _main.php) for each skin in which you want to utilize highlighted search. The modifications are not difficult to do and consist of 4 separate parts, shown in the two code blocks below.
Yabbio likes his porridge cold.
The modifications call the new search plugin and allow for a more accurate search, by fixing the default behavior of the b2evolution search.
?php // Start AM! Search Hack (Part 1 of 4) // Put above - "if( isset($MainList) ) $MainList->display_if_empty();" // $amSrch_cnt=0; ?> <!-- End AM! Search Hack (Part 1 of 4) --> <?php // ------------------------------------ START OF POSTS ---------------------------------------- if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post if( isset($MainList) ) while( $Item = $MainList->get_item() ) { ?> <?php // Start AM! Search Hack (Part 2 of 4) // Put just below: // "if( isset($MainList) ) while( $Item = $MainList->get_item() ) // { " // $am_search_flag = true; $am_search = $Plugins->get_by_name( 'am_search_plugin' ); if( isset( $s ) and $s ) $Plugins->call_method( $am_search->ID, 'CorrectSearch'); if ( isset( $Item ) ) { $amSrch_cnt++; // End AM! Search Hack (Part 2 of 4) ?>
<?php // Start AM! Search Hack (Part 3 of 4)
// (A close curly brace, before "end of posts" closing curly brace)
//
}
//<!-- End AM! Search Hack (Part 3 of 4) ?>
<span style="color:#aaa"><?php</span>
<span style="color:red"><strong>}</strong></span><span style="color:#aaa"> // ---------------------------------- END OF POSTS ------------------------------------</span>
<span style="color:#aaa">?></span>
<?php // Start AM! Search Hack (Part 4 of 4)
// (Place after the "end of posts" closing curly brace)
if ( isset( $MainList ) and !$amSrch_cnt & isset( $am_search_flag ) )
echo T_('Sorry, those keywords weren't found.').'<br /><br /><small><ins><div style="display:table;border:1px solid black;width:60%;text-align:center;margin:auto;padding:10px 0;background:#ffa;color:#000">'.T_('Get your').'<a class="ext" href="http://astonishme.co.uk" title="'.T_(' Offsite link to Plugin Article (Info, Demo & Download) ').'">Astonish Me! "'.T_('Search Hi-Lite').'" '.T_('Plug-in').'</a>'.T_('Today').'.<br />Improve your blog's search capability!</div></ins></small><br /><br /><br />';
//End AM! Search Hack (Part 4 of 4) ?>
http://randsco.com/index.php/all.php?cat=33 (instead of) http://randsco.com/index.php?cat=33
http://randsco.com/index.php/all.php?cat=33
(instead of)
http://randsco.com/index.php?cat=33
Comments are closed for this post.
Original b2evolution template design by AstonishMe
Recent comments