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

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

dedecms中的文章頁面的上一篇下一篇鏈接處怎么增加文章摘要?

Dedecms系統默認的是在文章的上一篇和下一篇的鏈接只顯示標題,但是有時我們希望顯示其他信息,比如文章的摘要。下面給大家介紹一下方法

??推薦學習:織夢cms

  DEDECMS系統默認的是在文章的上一篇和下一篇的鏈接只顯示標題,但是有時我們希望顯示其他信息,比如文章的摘要。

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

$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?";

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

  需要注意的是這里的jcode_archives和jcode_arctype中的jcode_是我表結構的前綴,你需要將這個前綴改成你自己的。

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

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-&gt;PreNext['pre']? =?"上一篇:<a>{$preRow['title']}</a>? "; $this-&gt;PreNext['preimg']?=?"<a>@@##@@</a>? "; } else { $this-&gt;PreNext['pre']?=?"上一篇:沒有了?";? $this-&gt;PreNext['preimg']? ="@@##@@"; } 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-&gt;PreNext['next']? =?"下一篇:<a>{$nextRow['title']}</a>? "; $this-&gt;PreNext['nextimg']?=?"<a>@@##@@</a>? "; } else { $this-&gt;PreNext['next']?=?"下一篇:沒有了?";? $this-&gt;PreNext['nextimg']?="<a alt="">@@##@@</a>"; } }

  現在為了顯示出文章描述,在每一個a標簽之后添加一個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-&gt;PreNext['pre']? =?"上一篇:<a>{$preRow['title']}</a>?<div>{$preRow['description']}</div>? "; $this-&gt;PreNext['preimg']?=?"<a>@@##@@</a>?<div>{$preRow['description']}</div>?";? } else { $this-&gt;PreNext['pre']? =?"上一篇:沒有了?"; $this-&gt;PreNext['preimg']?="@@##@@"; } 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-&gt;PreNext['next']? =?"下一篇:<a>{$nextRow['title']}</a>?<div>{$preRow['description']}</div>? "; $this-&gt;PreNext['nextimg']?=?"<a>@@##@@</a>?<div>{$preRow['description']}</div>?";? } else { $this-&gt;PreNext['next']? =?"下一篇:沒有了?"; $this-&gt;PreNext['nextimg']?="<a alt="">@@##@@</a>"; } }

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

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

? 版權聲明
THE END
喜歡就支持一下吧
點贊8 分享