News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Search Enhancement Mod

Started by ioszilla, August 12, 2007, 05:53:15 PM

Previous topic - Next topic

Qayyom Ashraf

after Installing of this MOD i face the attached problem,

please help me to remove code lines at the top of site.

if any senior member need admin ID n Password, i can give him
Qayyom Ashraf  |  Karachi-PK |::.www.JangForum.Com.::|

ioszilla

#161
Hi qayyom,

You need to edit \Themes\default\languages\Modifications.english.php to remove a redundant ?> at the end of the line(I believe).

If you need further help lemme know.  :)

shiawasekun

I'm using Dilber MC theme. I tried the custom code insert to show the drop-down search box but it sort of distorted the theme.

Any help pls?

SONSiVRi

Turkish support;

<!-- Turkish language -->
<file name="$themedir/languages/Errors.turkish.php" error="ignore">
<operation error="ignore">
<search position="end" />
<add><![CDATA[
$txt['error_search_string_small_words'] = 'Her kelime en az 2 harf uzunluğunda olmalıdır.';]]></add>
</operation>
</file>

<!-- Turkish language -->
<file name="$languagedir/Modifications.turkish.php" error="ignore">
<operation>
<search position="end" />
<add><![CDATA[
//Begin DC SMF Search Text Strings
$txt['specific_topic_id'] = 'Başlık numarası';
$txt['search_match_mode'] = 'Match Mode';
$txt['search_match_mode_whole'] = 'Tüm kelimeleri eşleştirme - az sonuç, az hata';
$txt['search_match_mode_smart'] = 'Akıllı eşleştirme - ortalama';
$txt['search_match_mode_any'] = 'Herhangi eşleştirme - fazla sonuç, fazla hata';

$txt['search_numReplies'] = 'Yanıtlar';
$txt['search_match_mode_whole_short'] = 'Tüm kelimeleri eşleştirme';
$txt['search_match_mode_smart_short'] = 'Akıllı eşleştirme';
$txt['search_match_mode_any_short'] = 'Herhangi eşleştirme';

$txt['result_summary'] = 'Arama özetini Göster/Gizle';

$txt['result_generated'] = 'Sonuçlar kullanılarak oluşturuldu: ';
$txt['zillarank'] = 'ZillaRank';

$txt['search_entireforum'] = 'Tüm Forumda';
$txt['search_thisbrd'] = 'Bu Bölümde';
$txt['search_thistopic'] = 'Bu başlıkta';
$txt['search_members'] = 'Kullanıcılarda';
$txt['search_entiresite'] = 'Tüm Sitede';

$txt['search_view_all'] = 'Hepsini göster';
$txt['search_match_criteria'] = 'mesaj bu başlıkta sizin aradığınıza uyuyor.';

$txt['search_go_to_top'] = 'Üste git';
$txt['search_go_to_top_single'] = 'Üst';
//END DC SMF Search Text Strings
]]></add>
</operation>
</file>
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

SONSiVRi

Quote from: wordzilla on August 13, 2007, 02:19:25 PM
How to add quick search box to your Custom (non-default) SMF Theme

I have implemented wordzilla's tutorial for Dilber Multicolor (1.1 RC3)



EDIT: Your_Theme_Dir/index.template.php

Operation 1

Find:

Quote
   echo '
               <td valign="middle" height="30" style="padding-top:0px; padding-bottom:0px; padding-right:20px;" class="middletext" align="right">
            <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
               <a href="', $scripturl, '?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0px;" alt="" /></a>
               <input type="text" name="search" value="" style="width: 190px;" />
               <input type="submit" name="submit" value="', $txt[182], '" style="width: 11ex;" />
               <input type="hidden" name="advanced" value="0" />';

   // Search within current topic?
   if (!empty($context['current_topic']))
      echo '
               <input type="hidden" name="topic" value="', $context['current_topic'], '" />';

      // If we're on a certain board, limit it to this board ;).
   elseif (!empty($context['current_board']))
      echo '
               <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

   echo '
            </form>

               </td>
            </tr>
         </table>
      </div>
      <div class="menubar">
         <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr>';
               // Show the menu here, according to the menu sub template.
                  template_menu();
      echo '
            </tr>
         </table>
      </div>';


Replace with:

Quote
   echo '
               <td valign="middle" height="30" style="padding-top:0px; padding-bottom:0px; padding-right:20px;" class="middletext" align="right">
            <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
               <a href="', $scripturl, '?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0px;" alt="" /></a>
               <input type="text" name="search" value="" style="width: 190px;" />';
   echo DropDownQuickSearch();
   echo '
               <input type="submit" name="submit" value="', $txt[182], '" style="width: 11ex;" />
               <input type="hidden" name="advanced" value="0" />';



   // If we're viewing a single topic
   if (!empty($context['current_topic']))
      echo '
                  <input type="hidden" name="acttopic" value="', $context['current_topic'], '" />';

   // If we're on a certain board
   if (!empty($context['current_board']))
      echo '
                  <input type="hidden" name="actbrd" value="', $context['current_board'], '" />';

   echo '
            </form>

               </td>
            </tr>
         </table>
      </div>
      <div class="menubar">
         <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr>';
               // Show the menu here, according to the menu sub template.
                  template_menu();
      echo '
            </tr>
         </table>
      </div>';



Operation 2

ADD the following code to the END of the file (but before the ending ?> ):

Quotefunction DropDownQuickSearch ()
{
   global $context, $txt;

   // in order!!
   $Selections = array(
      'entireforum' => $txt['search_entireforum'],
      'thisbrd' => $txt['search_thisbrd'],
      'thistopic' => $txt['search_thistopic'],
      'members' => $txt['search_members'],
      // Google site search
      'entiresite' => $txt['search_entiresite']
   );

   $default = 'entireforum';
      
   if (empty($context['current_topic']))
      unset ($Selections['thistopic']);

   if (empty($context['current_board']))
      unset ($Selections['thisbrd']);
   
   $str = '
   <select name="search_selection">';
   
   foreach ($Selections as $selection => $title)
      $str .= '
         <option value="' . $selection . '"' . ($selection == $default ? ' selected="selected"' : '') . '>' . $title . ' </option>';
   
   $str .= '
   </select>&nbsp;';
   
   return $str;
}
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

noelchiew

#165
I'm using 1.1.4 with black theme copy of the core theme. Tried to follow the instructions above to edit the index.template.php file but got faced some issues. Firstly the drop down menu is missing. Secondly, I compared the advance search screenshot of yours and mine had some text missing. The text missing are 'Specific topic id' and 'match mode'.

Is the above only for Dilber MC theme? I tried switching to the default to see if everything is ok there. The first issue is the same, those text missing. There is a drop down menu but there are no choices inside to select. All white inside.

noelchiew

I realised that one of the issue is due to the language. The mod appears on the default theme after changing the language to english before installing again.

However the mod does not appear to be in place in my own theme. I tried to follow the changes above and got an error about syntax. What should I change on my theme's index.template.php, index.php and style.css?

TrueSatan

Hardly any mods install into custom themes automatically and anything bar the SMF default theme is a custom theme. For general details of how to install into custom themes:

Please read:

http://docs.simplemachines.org/index.php?topic=402.msg531#msg531

http://www.simplemachines.org/community/index.php?topic=34526.0

The following may also prove helpful:

http://modparser.dev.dansoftaustralia.net/

Mirror of the last link:

http://www.smfhacks.com/smf-package-parser.html

Aileen

This is a great mod. But on installation I am having this error

Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Search.php    Test successful
2.    Execute Modification    ./Themes/default/index.template.php    Test failed
3.    Execute Modification    ./Themes/default/Search.template.php    Test successful
4.    Execute Modification    ./Themes/default/style.css    Test successful
5.    Execute Modification    ./Themes/default/languages/Errors.english.php    Test successful
6.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
7.    Execute Modification    ./Themes/default/languages/Errors.french.php    Test successful
8.    Execute Modification    ./Themes/default/languages/Modifications.french.php    Test successful
9.    Execute Modification    ./Themes/default/languages/Errors.spanish.php    Test successful
10.    Execute Modification    ./Themes/default/languages/Modifications.spanish.php    Test successful

I am using a dilber theme. Hope you can help me. thanks

SONSiVRi

Quote from: will888 on November 27, 2007, 06:28:09 PM
This is a great mod. But on installation I am having this error

Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Search.php    Test successful
2.    Execute Modification    ./Themes/default/index.template.php    Test failed
3.    Execute Modification    ./Themes/default/Search.template.php    Test successful
4.    Execute Modification    ./Themes/default/style.css    Test successful
5.    Execute Modification    ./Themes/default/languages/Errors.english.php    Test successful
6.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
7.    Execute Modification    ./Themes/default/languages/Errors.french.php    Test successful
8.    Execute Modification    ./Themes/default/languages/Modifications.french.php    Test successful
9.    Execute Modification    ./Themes/default/languages/Errors.spanish.php    Test successful
10.    Execute Modification    ./Themes/default/languages/Modifications.spanish.php    Test successful

I am using a dilber theme. Hope you can help me. thanks

You should manually check modifications on "Themes/default/index.template.php"  will be made by this mod and you may correct the mod installation file according to your forum. It cant find exact pattern what its needed to modify.
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Aileen

That would be hard for me since I am not really a developer, just learn through forums

noelchiew

Quote from: TrueSatan on November 26, 2007, 08:21:11 PM
Hardly any mods install into custom themes automatically and anything bar the SMF default theme is a custom theme. For general details of how to install into custom themes:

Please read:

http://docs.simplemachines.org/index.php?topic=402.msg531#msg531

http://www.simplemachines.org/community/index.php?topic=34526.0

The following may also prove helpful:

http://modparser.dev.dansoftaustralia.net/

Mirror of the last link:

http://www.smfhacks.com/smf-package-parser.html

Thanks, now I'm getting the hang of editing custom theme. Not very difficult to understand the smf-package-parser.

Ambasador

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND NOT (t.isSticky = 1 AND t.locked = 1), , COUNT(*) / (t.numReplies + 1)) + 25' at line 5
File: /home/ocilicom/public_html/forum/Sources/Search.php
Line: 1916

I get this when searching form the search results page. When searching from the search block (index template), I have no problems. Could you tell me what to do to fix this?

ioszilla

I think the problem has to do with missing variable $topic_without_enough_replies_penalty, probably you have a Search.php that was not properly modified.

Could you attach your Search.php here for me to have a look?

Ambasador

I found the variable on line 280, but it might be that something was not properly modified. I attached the file.

Thanks in advance!

ioszilla

Ambasador, it seems that you have visual verification mod installed and according to my diff report, there are quite a few missing/misplaced code blocks. Your current Search.php will not work properly.

I have attached my diff report for your reference. :)

Ambasador

Thanx! I've commented (/**/) all the lines for visual verification, and now reports a bit less errors. Now I only get errors when searching from the action=search2 page, and they disappear when I refresh it.



Hey, seems like I solved it by commenting these lines:

// REF (see above) ATTN: wordzilla, LEFT_JOIN
// LEFT JOIN smf_tmp_log_search_topics AS lst ON (lst.ID_TOPIC = t.ID_TOPIC)
// WHERE t.ID_TOPIC = m.ID_TOPIC
// AND lsm.ID_MSG = m.ID_MSG AND lst.ID_TOPIC = t.ID_TOPIC

db_query("
INSERT IGNORE INTO {$db_prefix}log_search_results
(" . implode(', ', array_keys($main_query['select'])) . ")
SELECT
" . implode(',
', $main_query['select']) . "
FROM (" . implode(', ', $main_query['from']) . ')' . (empty($main_query['left_join']) ? '' : "
LEFT JOIN " . implode("
LEFT JOIN ", $main_query['left_join'])) . "
WHERE " . implode("
AND ", $main_query['where']) . (empty($main_query['group_by']) ? '' : "
GROUP BY " . implode(', ', $main_query['group_by'])) . (empty($modSettings['search_max_results']) ? '' : "
LIMIT $modSettings[search_max_results]"), __FILE__, __LINE__);

$_SESSION['search_cache']['num_results'] = db_affected_rows();*/

ioszilla

hehe, i think you are messing up the entire script by commenting out lines that are really required for the Search.php to function. :P

Ambasador

Well, the search still works ;-)

MadTurki

Quote from: SONSiVRi on November 28, 2007, 06:47:21 AM
Quote from: will888 on November 27, 2007, 06:28:09 PM
This is a great mod. But on installation I am having this error

Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Search.php    Test successful
2.    Execute Modification    ./Themes/default/index.template.php    Test failed
3.    Execute Modification    ./Themes/default/Search.template.php    Test successful
4.    Execute Modification    ./Themes/default/style.css    Test successful
5.    Execute Modification    ./Themes/default/languages/Errors.english.php    Test successful
6.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
7.    Execute Modification    ./Themes/default/languages/Errors.french.php    Test successful
8.    Execute Modification    ./Themes/default/languages/Modifications.french.php    Test successful
9.    Execute Modification    ./Themes/default/languages/Errors.spanish.php    Test successful
10.    Execute Modification    ./Themes/default/languages/Modifications.spanish.php    Test successful

I am using a dilber theme. Hope you can help me. thanks

You should manually check modifications on "Themes/default/index.template.php"  will be made by this mod and you may correct the mod installation file according to your forum. It cant find exact pattern what its needed to modify.


I foolishly ignored this error and now I have:

Quote//Begin DC SMF Search Text Strings $txt['specific_topic_id'] = 'Specific topic id'; $txt['search_match_mode'] = 'Match Mode'; $txt['search_match_mode_whole'] = 'Match whole words only - least results, least noise'; $txt['search_match_mode_smart'] = 'Smart matching - balanced'; $txt['search_match_mode_any'] = 'Match any sequence - most results, most noise'; $txt['search_numReplies'] = 'Replies'; $txt['search_match_mode_whole_short'] = 'Match whole words only'; $txt['search_match_mode_smart_short'] = 'Smart matching'; $txt['search_match_mode_any_short'] = 'Match any sequence'; $txt['result_summary'] = 'Show/hide result summary'; $txt['result_generated'] = 'Results generated using '; $txt['zillarank'] = 'ZillaRank'; $txt['search_entireforum'] = 'Entire Forum'; $txt['search_thisbrd'] = 'This board'; $txt['search_thistopic'] = 'This topic'; $txt['search_members'] = 'Members'; $txt['search_entiresite'] = 'Entire Site'; $txt['search_view_all'] = 'View all'; $txt['search_match_criteria'] = 'posts in this topic that match your search criteria'; $txt['search_go_to_top'] = 'Go to Top'; $txt['search_go_to_top_single'] = 'Top'; //END DC SMF Search Text Strings

Written across the top of my page... I uninstalled the mod and got no resaults ....  wtg me.  Any suggestions?

Advertisement: