Welcome, Guest. Please Login or Register.
April 26, 2025, 11:41:25 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Completed mods  |  [Code All Version] Highlight seach result « previous next »
Pages: [1] Reply Ignore Print
Author Topic: [Code All Version] Highlight seach result  (Read 1683 times)
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

[Code All Version] Highlight seach result
« on: March 23, 2003, 01:57:23 AM »
Reply with quote

edit Search.php
find:      foreach ($searcharray as $query)
        $row['body'] = preg_replace("/((<[^>]*)|" . str_replace("/", "\\/", quotemeta($query)) . ")/ie", '"\2"=="\1" ? "\1" : "<b>\1</b>"', $row['body']);
replace with:      foreach ($searcharray as $query)
     {
        $row['body'] = preg_replace("/((<[^>]*)|" . str_replace("/", "\\/", quotemeta($query)) . ")/ie", '"\2"=="\1" ? "\1" : "<span class=\"highlight\">\1</span>"', $row['body']);
        $row['subject'] = preg_replace("/((<[^>]*)|" . str_replace("/", "\\/", quotemeta($query)) . ")/ie", '"\2"=="\1" ? "\1" : "<span class=\"highlight\">\1</span>"', $row['subject']);
     }
basically just change the <b> tag above with <span class=\"highlight\">
and the next line is for subject highlight

then in your CSS, add something like:
.highlight
{
  background-color: yellow; font-weight: bold;
  color: black;
}


The result will be like:
« Last Edit: July 18, 2003, 11:45:21 PM by Spaceman-Spiff » Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
Surfy
Sr. Member
****
Posts: 458


I'm a llama!

Re:[Code All Version] Highlight seach result
« Reply #1 on: March 26, 2003, 08:07:15 PM »
Reply with quote

Great Mod, but i fight with a little Bug:

I Use: YaBBse 1.4.1

With your Mod installed, all Postet Smilies arent shown correctly, it give deadlinks...

In the Image Properties of the Link it shows like:




http://www.myboard.com/'http://www.myboard.com/forum/Skins/design2_grey/Images/supi.gif/'



Whats wrong? I hope you understand my english...

If i swap the changes in search.php back it works again.

Surfy
Logged
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:[Code All Version] Highlight seach result
« Reply #2 on: March 26, 2003, 10:57:52 PM »
Reply with quote

here's the specific code for 1.4.1:
search for      foreach ($searcharray as $query)
        $row['body'] = preg_replace("/((\][^\[]*)|(^[^\[]*))(".str_replace("/", "\\/", quotemeta($query)).")/i","\\1<b>$query</b>",$row['body']);

replace with       foreach ($searcharray as $query)
      {
         $row['body'] = preg_replace("/((\][^\[]*)|(^[^\[]*))(".str_replace("/", "\\/", quotemeta($query)).")/i","\\1<span class=\"highlight\">$query</span>",$row['body']);
         $row['subject'] = preg_replace("/((\][^\[]*)|(^[^\[]*))(".str_replace("/", "\\/", quotemeta($query)).")/i","\\1<span class=\"highlight\">$query</span>",$row['subject']);
      }

also add the higlight css class
the code hasn't been tested, i dont have a 1.4.1 board anymore :P
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
Surfy
Sr. Member
****
Posts: 458


I'm a llama!

Re:[Code All Version] Highlight seach result
« Reply #3 on: March 27, 2003, 08:23:55 AM »
Reply with quote

thanks a lot!!

It works well!!    :-* :-*

Surfy
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [Code All Version] Highlight seach result « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.900 seconds with 16 queries.