織夢二次開發:dedecms當前文章標題加亮顯示

來源:互聯網
上載者:User

仲介交易 HTTP://www.aliyun.com/zixun/aggregation/6858.html">SEO診斷 淘寶客 雲主機 技術大廳

很多人在用dedecms仿站的時候,會用到在當前欄目頁面,欄目標題使用指定樣式(標題加亮,或者放個背景圖)。 這是一個很常用和實用的功能,比如在導航頁面,標識當前在流覽哪個欄目。 (如圖1)

  

(圖1)

但是有些時候,我們在調用幾篇文章的時候,需要把當前文章的標題加亮。 (如圖2)可是dedecms並沒有這個功能,下面我跟大家分享幾段代碼,來實現這個功能。

  

(圖2)

需要修改的檔為:include/taglib/arclist.lib.php

一、在65行插入:$currentstyle = $ctag->GetAtt('currentstyle');

  

二、在135行的$isweight後面加上:,$currentstyle

  

三、在170行的$isweight='N'和)之間加上:,$currentstyle=''

  

四、在519行的下方插入:

if($currentstyle && $row['id']==$arcid){

$currentstyle = str_replace('~typelink~', $row['filename'], $currentstyle);

$row['currentstyle'] = str_replace('~typename~', $row['title'], $currentstyle);

}

  

如果擔心自己修改會出錯,可以到HTTP://qinglvshuo.com/static/dede.rar 下載筆者修改好的檔。 修改好本檔之後,調用代碼如下:

{dede:arclist titlelen='42' row='10' currentstyle="

~typename~

"}

[field:array runphp='yes']

if(@me['currentstyle']){

@me = @me['currentstyle'];

}else{

@me = "

{@me['title']}

";

}

[/field:array]

{/dede:arclist}

代碼中的文章標題,行數和樣式名稱可以根據自己的需求來修改。

本文由情侶裝專賣店HTTP://qinglvshuo.com 原創,A5首發,希望能給需要此功能的站長帶來説明。 歡迎各位站長保留連結轉載。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.