dedecms列表中顯示文章完整標(biāo)題的解決辦法
更新時(shí)間:2008年03月23日 18:12:52 作者:
dedecms通過標(biāo)簽arclist輸出文章列表的時(shí)候,文章的標(biāo)題會(huì)被titlelen屬性截取為指定長度的字符串, 但是我們在實(shí)際使用的過程中,經(jīng)常會(huì)用到文章標(biāo)題的完整內(nèi)容,在dedecms中如何實(shí)現(xiàn)呢,方法很多,這里推薦通過小小的修改程序,達(dá)到目的。
解決方法:
修改include\inc\inc_fun_SpGetArcList.php文件,修改函數(shù)SpGetArcList,找到以下代碼:
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
修改為:
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['alltitle'] = $row['title']; //增加文章標(biāo)題屬性支持
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
代碼中增加了
$row['alltitle'] = $row['title'];
重新定義一個(gè)數(shù)組變量存放標(biāo)題的內(nèi)容。
然后你在模板中就可以使用類似[field:alltitle/]這樣的標(biāo)簽調(diào)用文章完整標(biāo)題。
例如:
{dede:arclist typeid='0' row='6' titlelen=32 orderby='pubdate'}
<li><a href="[field:filename /]" title="[field:alltitle/]">[field:title/]</a></li>
{/dede:arclist}
That about does it - enjoy!
修改include\inc\inc_fun_SpGetArcList.php文件,修改函數(shù)SpGetArcList,找到以下代碼:
復(fù)制代碼 代碼如下:
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
修改為:
復(fù)制代碼 代碼如下:
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['alltitle'] = $row['title']; //增加文章標(biāo)題屬性支持
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
$row['alltitle'] = $row['title'];
重新定義一個(gè)數(shù)組變量存放標(biāo)題的內(nèi)容。
然后你在模板中就可以使用類似[field:alltitle/]這樣的標(biāo)簽調(diào)用文章完整標(biāo)題。
例如:
復(fù)制代碼 代碼如下:
{dede:arclist typeid='0' row='6' titlelen=32 orderby='pubdate'}
<li><a href="[field:filename /]" title="[field:alltitle/]">[field:title/]</a></li>
{/dede:arclist}
That about does it - enjoy!
相關(guān)文章
為dedecms增加欄目文章統(tǒng)計(jì)功能代碼
有些網(wǎng)友希望為dedecms增加欄目文章統(tǒng)計(jì)的功能,這個(gè)功能并不復(fù)雜,但是dedecms本身并沒有此功能,以下是實(shí)現(xiàn)的方法:2008-03-03dedecms v5 跳轉(zhuǎn)網(wǎng)址 直接鏈接而非跳轉(zhuǎn)的實(shí)現(xiàn)方法修正版
最近在使用dedecms建站的時(shí)候發(fā)現(xiàn)這個(gè)問題,如果調(diào)轉(zhuǎn)網(wǎng)址是直接的連接地址,效果就更好了,網(wǎng)上的版本有點(diǎn)來,我也是參考他們的整理出來的2008-07-07dedecms負(fù)載性能優(yōu)化實(shí)例,三招讓你的dedecms快10倍以上
對(duì)dedecms表現(xiàn)出來的相對(duì)較差的性能也感覺比較迷惑,到底是什么在制約其負(fù)載效率?難道真的是某些腦殘的dede論壇版主說的是因?yàn)閙ysql不堪重負(fù)的原因嗎?2008-09-09dedecms下仿chinaz二級(jí)下拉動(dòng)態(tài)讀取代碼
最近用dedecms模仿chinaz的模板,發(fā)現(xiàn)每次都用靜態(tài)以后的文件特麻煩,沒想到網(wǎng)上已經(jīng)有高手給解決了,大家看代碼2008-05-05Dedecms 后臺(tái)驗(yàn)證碼錯(cuò)誤的解決方法
最近在本地搭建環(huán)境調(diào)試dedecms時(shí),發(fā)現(xiàn)安裝后后臺(tái)的驗(yàn)證碼無論如何都會(huì)提示輸入錯(cuò)誤,3.1有此情況,而3.01則不會(huì),上dede官方論壇和網(wǎng)上搜索都沒有找到解決的辦法,只能自己動(dòng)腦筋了~2009-03-03實(shí)現(xiàn)dedecms圖集單擊圖片翻頁的功能
題記:在很多相冊的網(wǎng)站中,都有這樣的功能:當(dāng)圖片分多頁顯示的情況下,點(diǎn)擊圖片會(huì)自動(dòng)翻頁到下一張圖片,接下來我們在dedecms4中實(shí)現(xiàn)這個(gè)功能。以下是實(shí)現(xiàn)方法:2008-03-03