Browse Source

Merge pull request #91 from beheh/master

Change limit_words to only show ellipsis when word count exceeds max
Gilbert Pellegrom 11 years ago
parent
commit
d35d87f3ea
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/pico.php

+ 3 - 1
lib/pico.php

@@ -342,7 +342,9 @@ class Pico {
 	private function limit_words($string, $word_limit)
 	private function limit_words($string, $word_limit)
 	{
 	{
 		$words = explode(' ',$string);
 		$words = explode(' ',$string);
-		return trim(implode(' ', array_splice($words, 0, $word_limit))) .'...';
+		$excerpt = trim(implode(' ', array_splice($words, 0, $word_limit)));
+		if(count($words) > $word_limit) $excerpt .= '…';
+		return $excerpt;
 	}
 	}
 
 
 }
 }