国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗(yàn) > 正文

在DedeCMS中的文章頁面的上一篇下一篇鏈接處增加文章摘要的方法

2024-04-25 20:50:37
字體:
供稿:網(wǎng)友
點(diǎn)評:DedeCMS系統(tǒng)默認(rèn)的是在文章的上一篇和下一篇的鏈接只顯示標(biāo)題,但是有時(shí)我們希望顯示其他信息,比如文章的摘要。下面給大家介紹一下方法
 
 

  DedeCMS系統(tǒng)默認(rèn)的是在文章的上一篇和下一篇的鏈接只顯示標(biāo)題,但是有時(shí)我們希望顯示其他信息,比如文章的摘要。

找到arc.archives.class.php文件,在include目錄下面,然后查找“GetPreNext”這個(gè)函數(shù),將

$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath from `jcode_archives` arc left join jcode_arctype t on arc.typeid=t.id ";

  改成:

$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, arc.description,t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath from `jcode_archives` arc left join jcode_arctype t on arc.typeid=t.id ";

  比較一下其實(shí)現(xiàn)在只是多了arc.description,這就是文章的摘要,也稱為文章描述。

  需要注意的是這里的jcode_archives和jcode_arctype中的jcode_是我表結(jié)構(gòu)的前綴,你需要將這個(gè)前綴改成你自己的。

  現(xiàn)在我們已經(jīng)將文章描述從數(shù)據(jù)庫里面取出來了。下一步將描述顯示在頁面上,顯示連接文字的代碼本來是這樣的,你可以通過查找找到,其實(shí)就在上面那段代碼的附近:

if(is_array($preRow)){$mlink = GetFileUrl($preRow['id'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";$this->PreNext['preimg'] = "<a href='$mlink'><img src="{$preRow['litpic']}" style="padding: 0px; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb(255, 0, 255); ">"{$preRow['title']}"/></a> ";}else{$this->PreNext['pre'] = "上一篇:沒有了 "; $this->PreNext['preimg'] ="<img src="/templets/default/images/nophoto.jpg" alt="對不起,沒有上一圖集了!"/>";}if(is_array($nextRow)){$mlink = GetFileUrl($nextRow['id'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']);$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";$this->PreNext['nextimg'] = "<a href='$mlink'><img src="{$nextRow['litpic']}" style="padding: 0px; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb(255, 0, 255); ">"{$nextRow['title']}"/></a> ";}else{$this->PreNext['next'] = "下一篇:沒有了 "; $this->PreNext['nextimg'] ="<a href='javascript:void(0)' alt=""><img src="/templets/default/images/nophoto.jpg" alt="對不起,沒有下一圖集了!"/></a>";}}

  現(xiàn)在為了顯示出文章描述,在每一個(gè)a標(biāo)簽之后添加一個(gè)div div中包含文章描述:

if(is_array($preRow)){$mlink = GetFileUrl($preRow['id'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> <div>{$preRow['description']}</div> ";$this->PreNext['preimg'] = "<a href='$mlink'><img src="{$preRow['litpic']}" style="padding: 0px; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb(255, 0, 255); ">"{$preRow['title']}"/></a> <div>{$preRow['description']}</div> "; }else{$this->PreNext['pre'] = "上一篇:沒有了 ";$this->PreNext['preimg'] ="<img src="/templets/default/images/nophoto.jpg" alt="對不起,沒有上一圖集了!"/>";}if(is_array($nextRow)){$mlink = GetFileUrl($nextRow['id'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']);$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> <div>{$preRow['description']}</div> ";$this->PreNext['nextimg'] = "<a href='$mlink'><img src="{$nextRow['litpic']}" style="padding: 0px; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb(255, 0, 255); ">"{$nextRow['title']}"/></a> <div>{$preRow['description']}</div> "; }else{$this->PreNext['next'] = "下一篇:沒有了 ";$this->PreNext['nextimg'] ="<a href='javascript:void(0)' alt=""><img src="/templets/default/images/nophoto.jpg" alt="對不起,沒有下一圖集了!"/></a>";}}

  這樣做的話能顯示文章摘要,但是格式可能會很亂,你可以根據(jù)需要增加樣式。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 满洲里市| 诸城市| 武乡县| 商城县| 长沙县| 青海省| 桓仁| 武清区| 鹤山市| 望城县| 沾益县| 湖口县| 布尔津县| 微山县| 衡山县| 正宁县| 永吉县| 杨浦区| 信丰县| 溧阳市| 平和县| 大田县| 凌源市| 和平区| 雅江县| 商丘市| 宁安市| 金秀| 龙海市| 黑水县| 依兰县| 图木舒克市| 鄂尔多斯市| 呼玛县| 彰化县| 江源县| 邵阳市| 龙里县| 枣强县| 怀宁县| 崇文区|