織夢CMS二次開發教程 實現圖集縮略圖的分頁樣式
導讀:建站問題建站問題織夢CMS5.7版本里默認自帶有三種圖集樣式,模板名稱分別為article_image.htm、article_image_cl.htm(新浪樣式)、artic公司網站建設網站推廣優化seo。
織夢CMS5.7版本里默認自帶有三種圖集樣式,模板名稱分別為article_image.htm、article_image_cl.htm(新浪樣式)、article_image_new.htm(這個是5.7才有的圖文幻燈樣式)。最近在做女人說的圖集模板時發現dede默認的圖集模板無法像文章一樣實現分頁樣式,多次問 […]
織夢CMS5.7版本里默認自帶有三種圖集樣式,模板名稱分別為article_image.htm、article_image_cl.htm(新浪樣式)、article_image_new.htm(這個是5.7才有的圖文幻燈樣式)。最近在做女人說的圖集模板時發現dede默認的圖集模板無法像文章一樣實現分頁樣式,多次問度娘、谷哥均無果,于是仔細的對織夢的文件研究了一下發現織夢是可以實現這種樣式的(如下圖)。現將方法分享給大家,這也是織夢論壇上大家最熱關注的焦點哦!

問題分析:
若要實現這種分頁方式,第一在要在分頁時把縮略圖的地址也調用進去,可是打開分頁標簽文件一看,沒有縮略圖數據。那怎么辦。我們只能通過二次開發進行新建一個專門用來圖集分頁調用的一個函數,如果要改動{dede:pagebreak/}的話,在文章的相關分頁方式上可能會出現問題。因此建議我們自己新建函數以免出現其他問題。
解決方法:
第一步:打開arc_archives_class.php,在include目錄下,在結尾處加上以下代碼:
/** * 獲得動態頁面圖集中圖片縮略列表 * * @access public * @param int $totalPage 總頁數 * @param int $nowPage 當前頁數 * @param int $aid 文檔id * @return string */ function GetlitpicDM_list($totalPage,$nowPage,$aid) { global $dsql,$sqlCt; $attlist="desclen|80"; FillAttsDefault($ctag->CAttribute->Items,$attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if(!isset($this->addTableRow['imgurls'])) return ; $revalue = ''; $dtp = new DedeTagParse(); $dtp->LoadSource($this->addTableRow['imgurls']); $images = array(); if(is_array($dtp->CTags)) { $pagenum=1; foreach($dtp->CTags as $ctag1) { if($ctag1->GetName()=="img") { $litpic.='<LI> <DIV class=img><A title="'. $ctag1->GetAtt('text').'" href="view.php?aid='.$aid.'&pageno='.$pagen百度seo網站優化um.'"><IMG style="BACKGROUND-IMAGE: url('.$ctag1->GetAtt('ddimg').')" src="'.$GLOBALS['cfg_templets_skin'].'/tukustyle/blankBg.gif" ></A></DIV><A href="view.php?aid='.$aid.'&pageno='.$pagenum.'">'.substr($ctag1->GetAtt('text'), 30).'</A> </LI>'; $pagenum++; } } } return $litpic; } /** * 獲得靜態頁面圖集中圖片縮略列表 * * @access public * @param int $totalPage 總頁數 * @param int $nowPage 當前頁數 * @param int $aid 文檔id * @return string */ function Getlitpic_list($totalPage,$nowPage,$aid) { global $dsql,$sqlCt; $attlist="desclen|80"; FillAttsDefault($ctag->CAttribute->Items,$attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if(!isset($this->addTableRow['imgurls'])) return ; $revalue = ''; $dtp = new DedeTagParse(); $dtp->LoadSource($this->addTableRow['imgurls']); $images = array(); if(is_array($dtp->CTags)) { $pagenum=1; foreach($dtp->CTags as $ctag1) { if($ctag1->GetName()=="img") { if($pagenum==1) { $litpic.='<LI> <DIV class=img><A title="'. $ctag1->GetAtt('text').'" href="'.$this->NameFirst.'.'.$this->ShortN網站建設教程ame.'"><IMG style="BACKGROUND-IMAGE: url('.$ctag1->GetAtt('ddimg').')" src="'.$GLOBALS['cfg_templets_skin'].'/tukustyle/blankBg.gif" ></A></DIV><A href="'.$this->NameFirst.'_'.$pagenum.'.'.$this->ShortName.'">'.substr($ctag1->GetAtt('text'),0,30).'</A> </LI>'; } else { $litpic.='<LI> <DIV class=img><A title="'. $ctag1->GetAtt('text').'" href="'.$this->NameFirst.'_'.$pagenum.'.'.$this->ShortName.'"><IMG style="BACKGROUND-IMAGE: url('.$ctag1->GetAtt('ddimg').')" src="'.$GLOBALS['cfg_templets_skin'].'/tukustyle/blankBg.gif" ></A></DIV><A href="'.$this->NameFirst.'_'.$pagenum.'.'.$this->ShortName.'">'.substr($ctag1->GetAtt('text'),0,30).'</A> </LI>'; } $pa網站推廣優化seogenum++; } } } return $litpic; }
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-26 ,文章織夢CMS二次開發教程 實現圖集縮略圖的分頁樣式主要講述分頁,圖集,CMS網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_10116.html