婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 網(wǎng)站建設 > 建站知識 > DEDECMS調(diào)用特定ID文章內(nèi)容的實現(xiàn)方法

DEDECMS調(diào)用特定ID文章內(nèi)容的實現(xiàn)方法

POST TIME:2019-10-12 00:02

方法一:
找到:includeinc_arcpart_view.php文件,在里面找到第function ParseTemplet();這一個函數(shù)里面的

代碼如下:

$this->dtp->Assign($tagid,
$this->GetArcList($typeid,$ctag->GetAtt("row"),$ctag->GetAtt("col"),
$titlelen,$infolen,$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),
$ctag->GetAtt("type"),$orderby,$ctag->GetAtt("keyword"),$innertext,
$ctag->GetAtt("tablewidth"),0,"",$channelid,$ctag->GetAtt("limit"),$ctag->GetAtt("att"),
$ctag->GetAtt("orderway"),$ctag->GetAtt("subday"),$autopartid,$ctag->GetAtt("ismember")
)


將里面的紅色的0改為$ctag->GetAtt('arcid'),就行了,然后到inccludeincinc_fun_spgetarclist.php文件里面找到
〔if($arcid!=0) $orwhere .= " And arc.ID<>'$arcid' ";〕
將這一句改為:if($arcid!=0) $orwhere .= " And arc.ID='$arcid' ";
if($arcid==0) $orwhere .= " And arc.ID<>'$arcid' ";
以上兩句,替換掉上面需要替換的語句。然后就可以調(diào)用了:如在主頁中調(diào)用ID號為145的文章內(nèi)容:

代碼如下:
{dede:arclist arcid='145' row='5' col='1' titlelen='24' }
<table width='100%' border='0' cellspacing='2' cellpadding='2'>
<tr>
<td>[field:title/]
[field:info/]</td>
</tr>
</table>
{/dede:arclist}

這樣就只會調(diào)用到一個ID為145的文章,即始ROW設為5也沒有用,因為從數(shù)據(jù)庫里面只提出一條記錄來,
但是現(xiàn)在還不能解析HTML語法,提出來的文章沒有版式,下次改進。
方法二:
剛一開始沒有仔細看論壇,所以自已寫出這樣的方法,其實大可不必按以上的方法做,可以借助強大的LOOP來實現(xiàn)這一種需求,現(xiàn)將個人方法寫在下面,希望對需要的人有幫助;
在首頁模板里面加入如下代碼:

代碼如下:
{dede:loop table='dede_addonarticle' sort='aid' row='8' if='aid=524'}
[field:body/]
<hr>
[field:body function="Html2Text(cn_substr('@me',200))" /]
{/dede:loop}

注意下面的這一行:
{dede:loop table='dede_addonarticle' sort='aid' row='8' if='aid=524'}
其中有一個aid=524代表要取文章列表的ID號為524的文章,
table='dede_addonarticle' 為所存文章的表
其中中間的這一行最重要,
[field:body function="Html2Text(cn_substr('@me',200))" /]
這一句有多種調(diào)用方式:
如:[field:body/]將得到文章所有的內(nèi)容,不過濾HTML標記
[field:body function="(cn_substr('@me',200))" /]
只取內(nèi)容的前200個字符
[field:body function="Html2Text(cn_substr('@me',200))" /]
取前200個字符并把HTML標記過濾
其實DEDECMS真的很強大,偶算是領教了。


收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 日喀则市| 邢台县| 梅河口市| 大石桥市| 甘孜县| 改则县| 古交市| 依安县| 赞皇县| 汕头市| 阿勒泰市| 清原| 吉林省| 万年县| 曲水县| 西和县| 邢台县| 丽水市| 昌平区| 沧源| 莲花县| 晋城| 尤溪县| 佛教| 镇巴县| 河间市| 牙克石市| 开封市| 老河口市| 鹤壁市| 时尚| 齐河县| 唐海县| 遵化市| 突泉县| 陆丰市| 荣昌县| 七台河市| 东方市| 安达市| 青冈县|