源码论坛公告:本站是一个交流学习建站资源的社区论坛,旨在交流学习源码脚本等资源技术,欢迎大家投稿发言! 【点击此处将锦尚放在桌面

源码论坛,商业源码下载,尽在锦尚中国商业源码论坛

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 8049|回复: 0
打印 上一主题 下一主题

[帝国教程] 帝国cms灵动标签调用多表多模型调用文章的方法

[复制链接]

1169

主题

1557

帖子

8820

金币

超级版主

Rank: 8Rank: 8

积分
19326
跳转到指定楼层
1#
发表于 2020-6-9 15:47:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

调用多模型的最新文章写法:

  1. [e:loop={'select * from (
  2. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_movie where newstime union
  3. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_news where newstime union
  4. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_photo where newstime union
  5. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_flash where newstime union
  6. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_article where newstime
  7. ) a order by newstime desc limit 10',10,24,1}]
  8. <a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
  9. [/e:loop]
复制代码


帝国CMS多表调用最新信息,该演示代码为默认数据表下全站最新10条图片信息,自己根据需求可以附加条件,实现全站点击,全站头条,全站推荐等等.
注释:以上多个模型用“Union”连接调用
若只调用图片:要加ispic=1条件

举例:

  1. [e:loop={'select * from (
  2. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_news where newstime and ispic=1 union
  3. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_photo where newstime and ispic=1 union
  4. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_flash where newstime and ispic=1 union
  5. select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_article where newstime and ispic=1) a order by newstime desc limit 10',10,24,1}]
  6. <a href="<?=$bqsr['titleurl']?>" target="_blank"><img src="<?=$bqr['titlepic']?>"/><?=$bqr['title']?></a> <br>
  7. [/e:loop]
复制代码

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

锦尚中国源码论坛

聚合标签|锦尚中国,为中国网站设计添动力 ( 鲁ICP备09033200号 ) |网站地图

GMT+8, 2024-5-3 01:26 , Processed in 0.029990 second(s), 20 queries .

带宽由 锦尚数据 提供 专业的数据中心

© 锦尚中国源码论坛 52jscn Inc. 非法入侵必将受到法律制裁 法律顾问:IT法律网 & 褚福省律师 锦尚爱心 版权申诉 版权与免责声明