首页 > CMS教程 > 帝国CMS    日期:2024-01-24 / 来自墨鱼部落格 / 浏览

因为在列表模板中不支持“自定义列表的字段”,所以用“自定义列表的字段”as “列表模板支持的字段”变量名。

1、调用所有专题
统计:select count(*) as total from [!db.pre!]enewszt
查询:select ztname as title,ztpath as titleurl,ztimg as titlepic,addtime as newstime,intro as smalltext,ztpagekey as pagekey,ztid as classid from [!db.pre!]enewszt

2、调用指定专题下的所有子专题
统计:select count(*) as total from [!db.pre!]enewszt where zcid=2
查询:select ztname as title,ztpath as titleurl,ztimg as titlepic,addtime as newstime,intro as smalltext,ztpagekey as pagekey,ztid as classid from [!db.pre!]enewszt where zcid=2

注释:
因为
ztname as title, ztpath as titleurl,ztimg as titlepic,addtime   as  newstime,    intro as smalltext,ztpagekey as pagekey,   ztid as classid
专题名称   标题  专题链接   标题链接 专题图片  标题图片  专题创建时间  文章发布时间  专题简介  文章简介  专题关键字    文章关键字 专题ID   文章ID
所以列表模板中:用“标题”代替调用“专题名称”其他以此类推

附加排列方式:order by ztid desc  使用方法加到上面查询语句的最后面
及调用条数 limit 1  使用方法加到上面排列方式的后面

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章

1 2 3 4 5