function fd_smart_excerpt($atts) { global $thisarticle; extract(lAtts(array( 'styleclass' => 'permalink', 'linktext' => '#', 'linktitle' => 'Permanent link to', ),$atts)); $link = ''.$linktext.' ~ (' . $thisarticle["comments_count"] . ') ' .safe_strftime('%d·%m·%y', $thisarticle['posted']).''; $text = trim($thisarticle["excerpt"]) ? trim($thisarticle["excerpt"]) : trim($thisarticle["body"]); // Be safe if(!$text) return '
' . $link . '
'; if(substr($text, -4) != "") return $text . '' . $link . '
'; return substr_replace($text, ' ' . $link . '', -4); }