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

当前位置: > DedeCMS教程 > DedeCMS安装使用 >

dedecms仿cnbeta显示栏目缩略图

来源: www.dedecms8.com 编辑:织梦吧 时间:2010-08-23点击:

仿cnbeta的关键是每个栏目对应一个缩略图,下面是我的一个思路:

首先通过后台SQL命令行工具给“栏目”对应的表:dede_arctype表加一个字段,用来放图片
具体命令是:

Copy code
ALTER TABLE dede_arctype  ADD typelitpic  varchar(80) NOT NULL DEFAULT ‘’;

将来图片的地址就是对应存放在typelitpic字段,你可以根据自己的喜欢取名;



接着

就是让{dede:arclist /} 能获取 dede_arctype.typelitpic里的值


方法是在后台:◇标签源码碎片管理 >> 修改标签


修改 arclist.lib.php


Copy code

   <?php



if(!defined('DEDEINC')) exit('Request Error!');



function lib_arclist(&$ctag,&$refObj)


{


    global $envs;



    $autopartid = 0;


    $tagname = $ctag->GetTagName();


    $channelid = $ctag->GetAtt('channelid');



    if($tagname=='imglist' || $tagname=='imginfolist') {


  $listtype = 'image';


    }


    else if($tagname=='specart') {


  $channelid = -1;


  $listtype='';


    }


    else if($tagname=='coolart') {


  $listtype = 'commend';


    }


    else if($tagname=='autolist') {


  $autopartid = $ctag->GetAtt('partsort');


    }


    else {


  $listtype = $ctag->GetAtt('type');


    }



    //排序


    if($ctag->GetAtt('sort')!='') $orderby = $ctag->GetAtt('sort');


    else if($tagname=='hotart') $orderby = 'click';


    else $orderby = $ctag->GetAtt('orderby');



    //对相应的标记使用不同的默认innertext


    if(trim($ctag->GetInnerText()) != '') $innertext = $ctag->GetInnerText();


    else if($tagname=='imglist') $innertext = GetSysTemplets('part_imglist.htm');


    else if($tagname=='imginfolist') $innertext = GetSysTemplets('part_imginfolist.htm');


    else $innertext = GetSysTemplets("part_arclist.htm");



    //兼容titlelength


    if($ctag->GetAtt('titlelength')!='') $titlelen = $ctag->GetAtt('titlelength');


    else $titlelen = $ctag->GetAtt('titlelen');



    //兼容infolength


    if($ctag->GetAtt('infolength')!='') $infolen = $ctag->GetAtt('infolength');


    else $infolen = $ctag->GetAtt('infolen');



    $typeid = trim($ctag->GetAtt('typeid'));


    if(empty($typeid)) {


  $typeid = ( isset($refObj->Fields['typeid']) ? $refObj->Fields['typeid'] : $envs['typeid'] );


    }



    if($listtype=='autolist') {


  $typeid = lib_GetAutoChannelID($ctag->GetAtt('partsort'),$typeid);


    }



    if($ctag->GetAtt('att')=='') {


  $flag = $ctag->GetAtt('flag');


    }


    else {


  $flag = $ctag->GetAtt('att');


    }



    return lib_arclistDone


        (


          $refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen,


          $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby,


          $ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid,


          $ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag')


        );


}



function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160,


        $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='',

About D8

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