好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

dedecms 调用图集中第一张大图而非缩略图方法 -

dedecms 调用图集中第一张大图而非缩略图方法

1.修改include/extend.func.php,添加如下代码:

//取第一张图地址   function  firstimg( $str_pic )  {  $str_sub = substr ( $str_pic ,0,-7). ".jpg" ; //删除缩略图字符串最后七位,然后再补上后缀.jpg   return   $str_sub ;  } 

DEDE调用大图调用原图

2.include/taglib/arclist.lib.php 第510行的位置添加:

$row['first_imgurl'] = Get_firstbigimg($row['id']);

然后在模板里循环调用:

[field:litpic function=firstimg('@me')/]

如:

{dede:list pagesize= '12'  titlelen= '20' }  【dd】     【a href= "[field:arcurl/]"  target= "_blank"  title= "[field:title/]"    class = "png" 】        【img src= "[field:litpic function=firstimg('@me')/]"   alt= "[field:title/]"   width= "213"  height= "261"  /】   【cite】[field:title/]【/cite】                     【i】time:【em】[field:pubdate  function = "MyDate('Y.m.d',@me)" /]【/em】【/i】   //phpfensi.com       【/a】  【/dd】  {/dede:list} 

如要直接调用用:{dede:field name='litpic' function="firstimg(@me)"/}

查看更多关于dedecms 调用图集中第一张大图而非缩略图方法 -的详细内容...

  阅读:46次