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)文章
實(shí)現(xiàn)讓DeDecms的上下文章鏈接限制在當(dāng)前欄目內(nèi)
使用dedecms的時(shí)候,當(dāng)打開某篇文章的時(shí)候,底部會(huì)有“上一篇”“下一篇”的鏈接信息,默認(rèn)情況下,上下鏈接信息并沒有區(qū)分欄目的屬性,那么需要實(shí)現(xiàn)本欄目內(nèi)的上下篇,如何實(shí)現(xiàn)呢? 基本思路:實(shí)現(xiàn)上下文章鏈接的函數(shù)位于GetPreNext(),我們在這個(gè)函數(shù)中獲得欄目ID,然后修改SQL語句,在查詢數(shù)據(jù)庫的時(shí)候加上欄目ID的限制。2008-03-03
DeDecms中實(shí)現(xiàn)更漂亮整齊的縮略圖的實(shí)現(xiàn)代碼
dede的縮略圖被很多人投訴過,其原因是直接將原有的大圖限制塊寬度直接縮小或放大,如此一來自然縮略圖的效果非常差。本身php就允許對圖片進(jìn)行各種截取、重新生成、合并、壓縮等操作,因此為了追求完美,你可以參考下文。2008-03-03
dedecms v5.1 WriteBookText() code injection vul注入漏洞
來源:Ph4nt0m Google Group by Flyh4t@126.com QQ:3783679422008-05-05
dedecms 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-07
DEDECMS后臺(tái)數(shù)據(jù)備份還原的應(yīng)用
前臺(tái)與測試過程--之備份與還原2009-02-02

