Stripping Spaces and Line Breaks from the smalltext Excerpt in Empire CMS Templates

ecms-code

When Empire CMS generates a post's excerpt automatically, it comes with spaces and line breaks baked in. That can't be rendered on a page as-is, so it has to be filtered.

Empire CMS smalltext

1. Filtering spaces and line breaks from smalltext in the content template

<?
$qian=array(" "," ","\t","\n","\r");
$hou=array("","","","","");
$smalltext=str_replace($qian,$hou,$navinfor[smalltext]);
echo $smalltext;
?>

2. Filtering them in the list template instead:
1. On the list item template (list.var), tick "Use program code."
2. Then use this code:

$r[smalltext]=str_replace(array("\r\n", "\r", "\n", "<br />", "</p>"),"",str_replace("<p>","",$r[smalltext]));
$listtemp='<li><p>[!--smalltext--]</p></li>';

Adjust the markup inside $listtemp to suit your list design.

Leave a Comment

Comments No Comments

Table of Contents