帝国CMS列表模板和内容模板过滤smalltext简介中的空格、换行

2021-01-2609:37:09网站建设与开发Comments1,512 views字数 562阅读模式

帝国CMS的内容简介如果采取自动生成的方式,会产生空格、换行,这种数据读取到页面上肯定是不行的,必须过滤处理。
帝国CMS列表模板和内容模板过滤smalltext简介中的空格、换行文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

一,内容模板使用以下代码,可过滤smalltext简介中的空格、换行:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

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

二,列表模板过滤smalltext简介中的空格、换行,方法如下:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

1,列表内容模板(list.var)右侧,勾选“使用程序代码”文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

2,采用以下代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

$r[smalltext]=str_replace(array("\r\n", "\r", "\n", "<br />", "</p>"),"",str_replace("<p>","",$r[smalltext]));
$listtemp='<li>
<p><a href="[!--titleurl--]" target="_blank">[!--title--]</a><span>[!--newstime--]</span></p>
<p>[!--smalltext--]</p>
</li>';

列表样式$listtemp中的内容自行修改。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/20894.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/cms/20894.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定