织梦CMS如何实现图集缩略图的分页样式-DEDECMS

资源魔 45 0

织梦CMS若何完成图集缩略图的分页款式?

织梦CMS二次开发教程 完成图集缩略图的分页款式

保举学习:织梦cms

织梦CMS5.7版本里默许自带有三种图集款式,模板称号辨别为article_image.htm、article_image_cl.htm(新浪款式)、article_image_new.htm(这个是5.7才有的图文幻灯款式)。比来正在做女人说的图集模板时发现dede默许的图集模板无奈像文章同样完成分页款式,屡次问度娘、谷哥均无果,于是细心的对织梦的文件钻研了一下发现织梦是能够完成这类款式的(以下图)。现将办法分享给各人,这也是织梦论坛上各人最热存眷的焦点哦!

3f91dd31f9eeb726f4d5c64fc66e806.png

成绩剖析:

若要完成这类分页形式,第一正在要正在分页时把缩略图的地点也挪用出来,可是关上分页标签文件一看,不缩略图数据。那怎样办。咱们只能经过二次开发进行新建一个专门用来图集分页挪用的一个函数,假如要改动{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='.$pagenum.'"><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->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>';
}
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>';
}
$pagenum++;
}
}
}
return $litpic;
}

标签: 织梦教程 织梦技巧 dedecms教程 dede问题解决 织梦

抱歉,评论功能暂时关闭!