帝国cms文章列表模板页读取newstext的内容
帝国cms的文章系统的内容是存放于文本中而不是存放于数据库中的,数据库中存放的是文本的路径,放与d xt目录下,在用文章系统做单页面时,可能会在列表页读取newstext字段,如:
[e:loop={"SELECT title,newstext FROM {$dbtbpre}ecms_article WHERE classid=$classid ORDER BY id LIMIT 1",0,24,0}] <h2><?=$bqr[title]?></h2> <div class="foabout"> <?=$bqr[newstext]?> </div>[/e:loop]
但这样读取出来的值是文章内容存放的路径,查找源代码,在eclassconnect.PHP文件大约3630行有个方法function
GetTxtFieldText($pagetexturl)function GetTxtFieldText($pagetexturl){global $ecms_config;if(empty($pagetexturl)){return ‘‘;}$file=$ecms_config[‘sets‘][‘txtpath‘].$pagetexturl.".php";$text=ReadFiletext($file);$text=substr($text,12);//去除exitreturn $text;}
调用这个方法就能把文章内容读取出来了,所以上面的代码改为如下即可:
[e:loop={"SELECT title,newstext FROM {$dbtbpre}ecms_article WHERE classid=$classid ORDER BY id LIMIT 1",0,24,0}] <h2><?=$bqr[title]?></h2> <div class="foabout"> <?=GetTxtFieldText($bqr[newstext])?> </div>[/e:loop]
下一篇:帝国CMS内容页字段没有填写就不显示的判断显示修改方法!
列表模板 newstext