許多人正在用dedecms仿站的時刻,會用到正在當前欄目頁裡,欄目的題應用指定款式(題目減明,大概放個配景圖)。那是一個很經常使用戰適用的功效,好比正在導航頁裡,標識當前正在閱讀哪一個欄目。(如圖1)
(圖1)
然則有些時刻,我們正在挪用幾篇文章的時刻,須要把當前文章的題目減明。(如圖2)但是dedecms並出有那個功效,上面我跟年夜傢分享幾段代碼,去真現那個功效。
(圖2)
須要修正的文件為:include/taglib/arclist.lib.php
1、正在65止插進:$currentstyle = $ctag->GetAtt(‘currentstyle’);
2、正在135止的$isweight背面減上:,$currentstyle
3、正在170止的$isweight=’N’戰)之間減上:,$currentstyle=”
4、正在519止的下圓插進:
if($currentstyle && $row[‘id’]==$arcid){
$currentstyle = str_replace(‘~typelink~’, $row[‘filename’], $currentstyle);
$row[‘currentstyle’] = str_replace(‘~typename~’, $row[‘title’], $currentstyle);
}
修正好本文件以後,挪用代碼以下:
{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}
代碼中的文章題目,止數戰款式稱號能夠依據本身的需供去修正。