靈動(dòng)標(biāo)簽調(diào)用多表多模型調(diào)用文章
1、調(diào)用多模型的最新文章
[e:loop={'select * from (
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_movie where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_news where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_photo where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_flash where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_article where newstime) a order by newstime desc limit 10',10,24,1}]
=$bqr['title']?> [/e:loop]
帝國(guó)CMS多表調(diào)用最新信息,該演示代碼為默認(rèn)數(shù)據(jù)表下全站最新10條圖片信息,自己根據(jù)需求可以附加條件,實(shí)現(xiàn)全站點(diǎn)擊,全站頭條,全站推薦等等.
---------------------------------------------------------------------------------
2、調(diào)用多模型的最新文章
[e:loop={'
select title,titleurl,titlepic from [!db.pre!]ecms_photo Union All
select title,titleurl,titlepic from [!db.pre!]ecms_download Union All
select title,titleurl,titlepic from [!db.pre!]ecms_news',0,24,0}]
=$bqr['title']?> [/e:loop]
注釋:以上調(diào)用的是(圖片模型:photo、下載模型:download、新聞模型:news)三個(gè)模型的文章
三個(gè)模型用"Union All"連接調(diào)用
若指定欄目用:where classid in(46,47,51),
若調(diào)用推薦在其后追加:and isgood=1,
若指定調(diào)用條數(shù)在其后追加:limit 10