专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 帝国cms

帝国cms使用灵动标签同时调用新闻和文章等多个表的头条等内容

发布时间: 文章来源:www.iduyao.cn 采编人员:毒药  
灵动标签同时调用多个表的最新内容,多个表用“union”连接:
[e:loop={'select * from ( 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_movie where newstime union 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_news where newstime union 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_photo where newstime union 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_flash where newstime union 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_article where newstime 
) a order by newstime desc limit 10',10,24,1}] 
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]

调用新闻和文章表的头条数据,0指不限有无有标题图片、两个4表示调用4条头条信息、24是指按sql查询:
[e:loop={'select * from ( 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_news where firsttitle=1 union 
select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_article where firsttitle=1
) a order by newstime desc limit 4',4,24,0}] 
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
   2384阅读

调用有图片的新闻和文章表的头条数据,最后一个1指必须有标题图片、前两个1表示调用1条头条信息、24是指按sql查询:

[e:loop={'select * from ( 
select titleurl,newstime,title,titlepic,onclick,smalltext from [!db.pre!]ecms_news where firsttitle=1 and ispic=1 union 
select titleurl,newstime,title,titlepic,onclick,smalltext from [!db.pre!]ecms_article where firsttitle=1 and ispic=1
) a order by newstime desc limit 1',1,24,1}] 
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]

毒药   2021-04-30 10:41:35
1

【排除部分栏目、排除头条和推荐】调用有图片的新闻和文章表的最新数据,最后一个1指必须有标题图片、前两个1表示调用1条头条信息、24是指按sql查询:

[e:loop={'select * from ( 
select titleurl,newstime,title,smalltext from [!db.pre!]ecms_news where newstime and classid not in(24,15,35) and isgood=0 and firsttitle=0 union 
select titleurl,newstime,title,smalltext from [!db.pre!]ecms_article where newstime  and classid not in(24,15,35) and isgood=0 and firsttitle=0 
) a order by newstime desc limit 10',10,24,0}] 
<li><a href='<?=$bqsr['titleurl']?>' target='_blank'><h6><?=$bqr['title']?></h6><p><?=$bqr['smalltext']?></p></a></li>
[/e:loop]

毒药   2021-04-30 12:26:46
2
登录 后发表评论

热门分类: