From 8d3cb601f6d6c0528ee9c204e7779739055a5f59 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 10 Nov 2009 04:11:33 +0000 Subject: Fixed displaying of ...s in search. git-svn-id: http://code.elgg.org/elgg/trunk@3658 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/search/start.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/search/start.php b/mod/search/start.php index 314aa4710..19de06dd7 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -249,8 +249,12 @@ function search_get_highlighted_relevant_substrings($haystack, $needle, $min_mat } $string = substr($haystack, $offset, $limit - $offset); - if ($limit-$offset < strlen($haystack)) { - $string = "$string..."; + if ($offset != 0) { + $string = "...$string"; + } + + if ($limit + $offset >= strlen($haystack)) { + $string .= '...'; } $substrings[] = $string; -- cgit v1.2.3