調(diào)用多模型的最新文章
[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]
帝國(guó)CMS多表調(diào)用最新信息,該演示代碼為默認(rèn)數(shù)據(jù)表下全站最新10條圖片信息,
自己根據(jù)需求可以附加條件,實(shí)現(xiàn)全站點(diǎn)擊,全站頭條,全站推薦等等.
注釋:以上多個(gè)模型用“Union”連接調(diào)用 若只調(diào)用圖片:要加ispic=1條件 舉例:
[e:loop={'select * from ( select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_news where newstime and ispic=1 union select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_photo where newstime and ispic=1 union select id,classid,titleurl,filename,title,newstime,titlepic from [!db.pre!]ecms_flash where newstime and ispic=1 union 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}] <a href="<?=$bqsr['titleurl']?>" target="_blank"><img src="<?=$bqr['titlepic']?>"/><?=$bqr['title']?></a> <br> [/e:loop]