午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    dedecms專題模板應(yīng)用分析及解決方案
    來源:易賢網(wǎng) 閱讀:883 次 日期:2014-08-19 13:50:40
    溫馨提示:易賢網(wǎng)小編為您整理了“dedecms專題模板應(yīng)用分析及解決方案”,方便廣大網(wǎng)友查閱!

    DeDeCms的專題相關(guān)信息bbs上相對(duì)較少,之前查閱了很多資料都未找到其解決方案

    無柰只有靠自己動(dòng)手豐衣足食;在官方的版本上有這樣的一段話:

    1、文章列表用ID1,ID2,ID3這樣形式分開,系統(tǒng)會(huì)自動(dòng)排除不同節(jié)點(diǎn)的相同文章;

    2、關(guān)于單條記錄模板里的[field:fieldname /]標(biāo)記的使用,請(qǐng)參考關(guān)于系統(tǒng)幫助關(guān)于 arclist 標(biāo)記的說明;

    3、節(jié)點(diǎn)ID是節(jié)點(diǎn)的唯一標(biāo)識(shí),允許在專題模板中用{dede:specnote id='標(biāo)識(shí)'/}這樣來表示單個(gè)節(jié)點(diǎn)。

    4、正常的情況下,每個(gè)節(jié)點(diǎn)顯示的是“節(jié)點(diǎn)文章列表”里的文檔,如果你指定為“自動(dòng)獲取模式”,那么必須指定關(guān)鍵字和欄目ID。

    可是經(jīng)測(cè)試{dede:specnote id='標(biāo)識(shí)'/}這個(gè)并沒有升效;因此開始解決這個(gè),以替換掉原來比較死板{dede:field name='note'/}標(biāo)簽;

    舉例說明:

    我要分兩欄顯示不同節(jié)點(diǎn)的文章,目前用"note"就不能實(shí)現(xiàn),只能是同一節(jié)點(diǎn)分欄,難免就顯得有些捌扭,不夠靈活。

    下面我就把自己解決方案寫下供同學(xué)們參考,首先得申明一點(diǎn),只能是實(shí)現(xiàn)了功能,可算法不一定是最好的,因?yàn)槲也惶煜ぃ模牛模牛茫停哟a且沒有認(rèn)真的研究過,希望大家海涵!

    步驟1:

    文件位置:{include/inc_archives_view.php}

    代碼如下:

    //廣告標(biāo)記

    //-----------------------

    else if($ctag->GetName()=="myad"){

    $this->dtp->Assign($tagid,$this->PartView->GetMyAd($typeid,$ctag->GetAtt("name")));

    }

    // 專題標(biāo)識(shí)

    // by phpfans

    else if($ctag->GetName()=="specnote"){

    $this->dtp->Assign($tagid,$this->ChannelUnit->GetSpecList('',$this->ChannelUnit->specrule,$ctag->GetAtt("id")));

    }

    介紹:{在廣告標(biāo)記下增加專題標(biāo)識(shí)}這樣專題文章列表頁就可以識(shí)別specnote標(biāo)簽了

    步驟2:

    文件位置:{include/inc_channel_unit.php}

    var $specrule;

    //-------------

    //php5構(gòu)造函數(shù)

    //-------------

    介紹:增加了對(duì)$pecrule變量的定義

    步驟3:

    文件位置:{include/inc_channel_unit.php}

    代碼如下:

    else if($ftype=="specialtopic"){

    $this->specrule = $fvalue;

    $fvalue = $this->GetSpecList($fname,$fvalue);

    }

    介紹:這兒增加了$this->specrule = $fvalue;這句,以便獲取addonspec表的note字段數(shù)據(jù);

    步驟4:

    文件位置:{include/inc_channel_unit.php}

    代碼如下:

    //獲得專題文章的列表

    //--------------------------------

    function GetSpecList($fname,$noteinfo,$noteid="")

    {

    if(!isset($GLOBALS['__SpGetArcList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");

    if($noteinfo=="") return "";

    $rvalue = "";

    $tempStr = GetSysTemplets("channel/channel_spec_note.htm");

    $dtp = new DedeTagParse(); </p> <p></p> <p>$dtp->LoadSource($noteinfo);

    if(is_array($dtp->CTags))

    {

    foreach($dtp->CTags as $k=>$ctag){

    $notename = $ctag->GetAtt("name");

    if($noteid!="" && $ctag->GetAtt("noteid")!=$noteid){ continue; } //指定名稱的專題節(jié)點(diǎn)

    if($noteid!="" && $ctag->GetAtt("noteid")===$noteid) {

    $isauto = $ctag->GetAtt("isauto");

    $idlist = trim($ctag->GetAtt("idlist"));

    $rownum = trim($ctag->GetAtt("rownum"));

    if(empty($rownum)) $rownum = 40;

    $keywords = "";

    $stypeid = 0;</p> <p>if($isauto==1){

    $idlist = "";

    $keywords = trim($ctag->GetAtt("keywords"));

    $stypeid = $ctag->GetAtt("typeid");

    }</p> <p>if(trim($ctag->GetInnerText())!="") $listTemplet = $ctag->GetInnerText();

    else $listTemplet = GetSysTemplets("spec_arclist.htm");

    $idvalue = SpGetArcList($this->dsql,

    $stypeid,$rownum,$ctag->GetAtt("col"),

    $ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),

    $ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),

    "all","default",$keywords,$listTemplet,100,0,$idlist);</p> <p>$notestr = str_replace("~notename~",$notename,$tempStr);

    $notestr = str_replace("~spec_arclist~",$idvalue,$notestr);

    $rvalue .= $notestr;

    if($noteid!="" && $ctag->GetAtt("noteid")==$noteid){ break; }

    }

    }

    }

    $dtp->Clear();

    return $rvalue;

    }

    介紹:有些小改動(dòng),自己對(duì)比一下就清楚了,這兒就不再哆嗦了

    步驟5:

    說明: 原{dede:field name='note'/}標(biāo)簽失效了,如果要用的朋友請(qǐng)自行修改步驟四部份。

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看CMS教程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:dedecms專題模板應(yīng)用分析及解決方案
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
    相關(guān)閱讀CMS教程

    2025國(guó)考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)