From 5202a6c3f092b1e576892af54aabc4e7ef1fefba Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Thu, 30 Jan 2014 01:52:07 +0700 Subject: [PATCH] Fix teaser Fix teaser offset error. --- system/includes/functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index 86aea33..68d7e72 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -663,7 +663,8 @@ function get_description($text) { return $string; } else { - return $string = substr($string, 0, strpos($string, ' ', config('description.char'))); + $string = substr($string, 0, config('description.char')); + return $string = substr($string, 0, strrpos($string, ' ')); } } @@ -679,7 +680,8 @@ function get_teaser($text, $url) { } else { $string = preg_replace('/\s\s+/', ' ', strip_tags($text)); - $string = substr($string, 0, strpos($string, ' ', config('teaser.char'))); + $string = substr($string, 0, config('teaser.char')); + $string = substr($string, 0, strrpos($string, ' ')); $body = $string . '...' . ' more' ; echo '

' . $body . '

'; }