帝國cms欄目列表頁調(diào)用內(nèi)容頁一篇文章
在列表模板使用代碼插入列表模板中:
[e:loop={"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' limit 1",1,24,0}]
<?php
$fr=$empire->fetch1("select newstext from phome_ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");
?>
標題:<?=$bqr[title]?><br>
內(nèi)容:<?=$fr[newstext]?>
[/e:loop]
代碼說明:
第一句
中含有的select * from phome_ecms_news where classid='$GLOBALS[navclassid]'
1、表示從新聞數(shù)據(jù)表中phome_ecms_news 選取全部的內(nèi)容,但是條件是classid='$GLOBALS[navclassid]'表示動態(tài)獲取當前的欄目或者分類,limit 1,下一個1,表示選擇顯示條數(shù)(好像沒用,受到limit 1 SQL語句控制),24,表示操作類型使用sql語法,0,表示不限定是否選擇有標題圖的文章;
第二句話:
$fr=$empire->fetch1("select newstext from phome_ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");
表示再次選擇以上欄目包含的id下的標題文章,newstext 代表文章內(nèi)容,id='$bqr[id]'表示條件是調(diào)用該欄目下的對應的id的文章內(nèi)容,如果將其更換成id=3,表示調(diào)用僅此id這一篇文章,
例面的例子:
[e:loop={"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' limit 1",0,24,0}]
<?php
$fr=$empire->fetch1("select newstext from phome_ecms_news_data_{$bqr[stb]} where id='469'");
?>
<?=$fr[newstext]?>
[/e:loop]
注意:limit 1和id='$bqr[id]'的使用方式,如果limit 4 表示循環(huán)調(diào)用出該欄目所有的文章內(nèi)容
調(diào)用截取部分文字信息:
[e:loop={"select * from phome_ecms_news where classid='87' limit 1",0,24,0}]
<?php
$fr=$empire->fetch1("select newstext from phome_ecms_news_data_{$bqr[stb]} where id='784'");
?>
<?=substr($fr[newstext],0,900)?>
[/e:loop]
相關(guān)推薦
-
帝國cms終極欄目/非終極欄目列表模板title調(diào)用欄目別名方法
帝國cms終極欄目非終極欄目列表模板titl調(diào)用欄目別名方法











