PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > Mod Submissions

Reply
 
Thread Tools
Old 05-05-2005, 03:17 PM   #1
mohrt
Green Mole
 
Join Date: May 2005
Posts: 1
word snippet truncation fix

I didn't like the way phpdig truncates words in the search snippets, so I removed the begin/end words (which are possible truncated)

here is the patch:

diff search_function.php.bak search_function.php
555c555,562
< $extract .= ' ...'.phpdigHighlight($reg_strings,$extract_content).'... ';
---
> // remove first (possibly truncated) word
> if(($first_space = strpos($extract_content, ' ')) !== false)
> $extract_content = substr($extract_content, $first_space + 1);
> // remove last (possibly truncated) word
> if(($last_space = strrpos($extract_content, ' ')) !== false)
> $extract_content = substr($extract_content, 0, $last_space);
>
> $extract .= ' ... '.phpdigHighlight($reg_strings,$extract_content).' ... ';
mohrt is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
phpdigSessionRemove() fix zas Mod Submissions 0 05-14-2007 07:09 AM
Indexing "<word>-<word>"? FaberFedor How-to Forum 23 02-28-2005 04:35 AM
links found : 0 -- Fix! David_Hogan Troubleshooting 0 05-06-2004 07:00 AM
Exclude meta tags from text snippet guillemc How-to Forum 2 05-03-2004 12:14 AM


All times are GMT -8. The time now is 05:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.