DedeCMS調用指定文章內容的兩種實現方法,織夢技術
導讀:織夢技術織夢技術有時候我們需要dedecms能夠調用指定文章的內容,尤其是在建企業網站的時候,需要在首頁調用網站簡介聯系我們什么的。今天,織夢技術研究中心就給大家介紹兩種實現調手機模板dede織夢的模板。
有時候我們需要dedecms能夠調用指定文章的內容,尤其是在建企業網站的時候,需要在首頁調用網站簡介聯系我們什么的。今天,織織夢模板安裝夢技術研究中心就給大家介紹兩種實現調用指定文章內容的方法。 方法一:打開include/inc_arcpart_view.php文件,在里面找到function ParseTemplet();這一個函數里面的如下代碼:
$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')
然后在incclude/inc/inc_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' ";
然后就可以調用了,如在主頁中調用文章id為145的文章內容,可以用如下代碼調用:
{dede:arclist arcid='145' row='5' col='1' titlelen='24' } [field:title/] [field:info/] {/dede:arclist}
這樣就只會調用到一個ID為145的文章,即始ROW設為5也沒有用,因為從數據庫里面只提出一條記錄來, 但是現在還不能解析HTM織夢模板免費L語法,提出來的文章沒有版式。 方法二: 可以借助強大的LOOP萬能標簽來實現這一種需求,在首頁模板里面加入如下代碼:
{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' 為所存文章的表 其中中間的這一行最重要:
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-22 ,文章DedeCMS調用指定文章內容的兩種實現方法,織夢技術主要講述兩種,文章內容,CMS網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_34419.html
