加拿大预测网-在线预测

信息动态

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

技术资讯

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 .= "

  • "; 


  •       ღ; &nbsꦿp; }else{ 


  •       &nඣbsp; &ဣnbsp;    $textinfoe=$textinfo[$i]; 


  •              $textinfoee=explode(" "𝔉,$textinfoe); 


  •  ♔           $imglist .= "

  • "; 


  •    💛;      } 



  •      } 


  •        return $im🃏glist; 


  •       }


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

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


  • {/dede:arc♐list}    &nbsꦯp; 


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

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'){ 
  ꦡ            $imglist .= "

  • "; 


  •      &nb𝓡sp;   }else{ 


  •              $textinfoe=$textinfo[$i];🍬 


  •              $textinfoee=e♌xplode(" ",$teওxtinfoe); 


  •         🏅; &nbs♊p;  $imglist .= "

  • "; 


  •     &nbs🐠p;    } 



  •      } 


  • 🅷       return $imglist; 


  •       } 

模板中 [field൲:❀id function="Getimgs(@me,220,80,90)" /]

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

 

 

0532-85810878 473587358 扫码添加微信

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

扫码关注公众号

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

2054585360