function shortDescription($fullDescription) {
$shortDescription = ”;
$fullDescription = trim(strip_tags($fullDescription));
if ($fullDescription) {
$initialCount = 125;
if (strlen($fullDescription) > $initialCount) {
//$shortDescription = substr(strip_tags($fullDescription),0,$initialCount).”…”;
$shortDescription = substr($fullDescription,0,$initialCount).”…”;
}
else {
return $fullDescription;
}
}
return $shortDescription;
}//End of function shortDescription
OR
function readMoreLink($inputParamArray) {
$description = $inputParamArray[‘description’];
$pageLink = $inputParamArray[‘pageLink’];
$readMoreLinkClass = $inputParamArray[‘readMoreLinkClass’];
if (trim($description) == ”) {
return ”;
}
$charLimitToDisplay = 255;
$description = strip_tags($description);
if (strlen($description) > $charLimitToDisplay) {
// truncate string
$stringCut = substr($description, 0, $charLimitToDisplay);
// make sure it ends in a word so assassinate doesn’t become ass…
$description = substr($stringCut, 0, strrpos($stringCut, ‘ ‘)).’… <a href=”‘.$pageLink.'” target=”_parent”>Read More >></a><br>’;
}
}
Recent comments