[geeklog-cvs] geeklog-1.3/public_html article.php,1.32,1.33

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Tue Jun 24 15:09:00 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory internal.geeklog.net:/tmp/cvs-serv1888

Modified Files:
	article.php 
Log Message:
Updated code for highlighting words from a search query, provided by Marc Von Ahn.


Index: article.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/article.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** article.php	21 Jun 2003 20:47:12 -0000	1.32
--- article.php	24 Jun 2003 19:08:58 -0000	1.33
***************
*** 120,129 ****
  
              if ($query) {
!                 $mywords = explode(" ",$query);
                  foreach ($mywords as $searchword) {
!                     $A['introtext'] = preg_replace ("/($searchword)/i",
!                         "<span class=\"highlight\">\\1</span>", $A['introtext']);
!                     $A['bodytext'] = preg_replace ("/($searchword)/i",
!                         "<span class=\"highlight\">\\1</span>", $A['bodytext']);
                  }
              }
--- 120,127 ----
  
              if ($query) {
!                 $mywords = explode (" ", $query);
                  foreach ($mywords as $searchword) {
!                     $A['introtext'] = preg_replace ("/(\>(((?>[^><]+)|(?R))*)\<)/ie", "preg_replace('/(?>$searchword+)/i','<span class=\"highlight\">$searchword</span>','\\0')", "<x>" . $A['introtext'] . "<x>");
!                     $A['bodytext'] = preg_replace ("/(\>(((?>[^><]+)|(?R))*)\<)/ie", "preg_replace('/(?>$searchword+)/i','<span class=\"highlight\">$searchword</span>','\\0')" ,"<x>" . $A['bodytext'] . "<x>");
                  }
              }





More information about the geeklog-cvs mailing list