• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > DedeCMS教程 > Dedecms二次开发 >

获取DedeCMS图集栏目大图的方法(2)

来源: www.dedecms8.com 编辑:织梦吧 时间:2012-09-16点击:

2.3修改:include/channelunit.class.php
添加一个方法: (其实就是原来的方法做了一点修改.名字多个b;还有就是

 //修改$ddimg为$src请看代码里的此注释位置.)
function bGetlitImgLinks($fvalue){
         
        if($GLOBALS["htmltype"]=="dm"){
            if(empty($GLOBALS["pageno"])) $NowPage = 1;
            else $NowPage = intval($GLOBALS["pageno"]);
        }else{
            if(empty($GLOBALS["stNowPage"])) $NowPage = 1;
            else $NowPage = intval($GLOBALS["stNowPage"]);
        }
        
      $revalue = "";
      $dtp = new DedeTagParse();
    $dtp->LoadSource($fvalue);
    if(!is_array($dtp->CTags)){
        $dtp->Clear();
        return "无图片信息!";
    }
    $ptag = $dtp->GetTag("pagestyle");
    if(is_object($ptag)){
        $pagestyle = $ptag->GetAtt('value');
        $maxwidth = $ptag->GetAtt('maxwidth');
        $ddmaxwidth = $ptag->GetAtt('ddmaxwidth');
        $irow = $ptag->GetAtt('row');
        $icol = $ptag->GetAtt('col');
        if(empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width'];
    }else{
        $pagestyle = 2;
        $maxwidth = $GLOBALS['cfg_album_width'];
        $ddmaxwidth = 200;
    }
    if($pagestyle == 3){
      if(empty($irow)) $irow = 4;
      if(empty($icol)) $icol = 4;
    }
    $mrow = 0;
    $mcol = 0;
    $photoid = 1;
    $images = array();
      $TotalPhoto = sizeof($dtp->CTags);
    
    foreach($dtp->CTags as $ctag){
        if($ctag->GetName()=="img"){
            $iw = $ctag->GetAtt('width');
            $ih = $ctag->GetAtt('heigth');
            $alt = str_replace("'","",$ctag->GetAtt('text'));
            $src = trim($ctag->GetInnerText());
            //echo $src."<BR>";  //源图
            $ddimg = $ctag->GetAtt('ddimg');
            //echo $ddimg."<BR>"; //缩略图
            if($iw > $maxwidth) $iw = $maxwidth;
            $iw = (empty($iw) ? "" : "width='$iw'");
            if($GLOBALS["htmltype"]=="dm") {
                $imgurl = "view.php?aid=$this->ArcID&pageno=$photoid";
            }else{
                if($photoid==1){
                    $imgurl = $GLOBALS["fileFirst"].".html";
                }else{
                    $imgurl = $GLOBALS["fileFirst"]."_".$photoid.".html";
                }
            }
            $imgcls = "image".($photoid-1);
            //修改这里$ddimg改为$src
          $revalue .= "<dl><dt>$alt<dd>$src<dd>$ddimg<dd>$ddimg<dd><dd><div></div><div></div><dd><dd>$photoid</dd></dl>\r\n";
            $photoid++;
        }        
    }    
      unset($dtp);
      unset($images);
      return $revalue;        
    }

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 tom@tiptop.cn ,  QQ