加拿大预测网-在线预测

信息动态

网站设计是技术与创意的完美融合!

技术资讯

dede列表页调用图集注释

2014-08-18 22:24:29

青岛网站建设dede列表页调用图集注释或者调用图集列表,能够实现类似列表页面图集动画滚动等特效,调用图集这种方式的原因就是因为在后台用图集添加图片比较方便。在include/common.inc.php下♛增加:

////循环输出多张图片  
  function Getimgs($aid, $imgwith = 300, $imgheight = 270, $num = 0, $style = ''){ 
  global $dsql; 
  $imgurls = ''; 
  $row = $dsql -> getone("Select imgurls From`dede_addonimages` where aid='$aid'"); //  
  $imgurls = $row['imgurls']; 
  
// preg_match("'alt=(.+)border'", $imgurls,$array);  
//preg_replace("/'/",'', $array[1]);    
  
  preg_match_all("/{dede:img (.*)}(.*){/dede:img/isU", $imgurls, $wordcount); 
  $textinfo = $wordcount[1]; 
  $count = count($wordcount[2]); 
  if ($num > $count || $num == 0){ 
  $num = $count; 
  } 
      
  for($i = 0;$i < $num;$i++){ 
  if($style == 'li'){ 
  🌟;       𒀰;     $imglist .= "

  • "; 


  •    𝓀   &nbꩵsp;  }else{ 


  •     &nbs♑p;      ❀;  $textinfoe=$textinfo[$i]; 


  •     &🔴nbsp;        $textinfoee=explode(&q📖uot; ",$textinfoe); 


  • &nb𓆉sp;           $imglist .= "

  • "; 


  •      &nbs🐻p;   } 



  •      } 


  •        retur𓃲n $imglist; 


  •       }


列表页调用:
{dede:arclist orderby='pubdate' row=1 att=h} 

  •  
     
     
     
      
     [field:title/] 
     
     
     [field:id function="Getimgs(@me,80,80,9)" /] 


  • {/de🐬de:arclist}     &nbไsp;


需要在这个文件中加入如下代码:

includecommon.func.php

////循环输出多张图片  
  function Getimgs($aid, $imgwith = 300, $imgheight = 270, $num = 0, $style = ''){ 
  global $dsql; 
  $imgurls = ''; 
  $row = $dsql -> getone("Select imgurls From`dede_addonimages` where aid='$aid'"); //  
  $imgurls = $row['imgurls']; 
  
// preg_match("'alt=(.+)border'", $imgurls,$array);  
//preg_replace("/'/",'', $array[1]);    
  
  preg_match_all("/{dede:img (.*)}(.*){/dede:img/isU", $imgurls, $wordcount); 
  $textinfo = $wordcount[1]; 
  $count = count($wordcount[2]); 
  if ($num > $count || $num == 0){ 
  $num = $count; 
  } 
      
  for($i = 0;$i < $num;$i++){ 
  if($style == 'li'){ 
🍨          &nꦕbsp;   $imglist .= "

  • "; 


  •  &nb♏sp;    &nbs🅷p;  }else{ 


  •   &nbꦑsp;      &nb💧sp;   $textinfoe=$textinfo[$i]; 


  •              $textinfoee=expl♏ode(" ",$textinfoe); 


  •             $imglist .= &quo🎶t;

  • "; 


  •      &nb🎃sp;&nbs⛎p;  } 



  •      } 


  •        return $imglis🌱t; 


  •       } 

模板中 [fieldꦺ:id function=&q🙈uot;Getimgs(@me,220,80,90)" /]

说明: 第一个参数 当前ID 第二个第三个, 图片尺寸。 第四个图片张数。

 

 

0532-85810878 473587358 扫码添加微信

加拿大预测网-在线预测:扫码添加微信

扫码关注公众号

加拿大预测网-在线预测:官方公众号

2054585360