帝国CMS灵活调用的多图片集插件

1、将下面的代码,复制到你的userfun.php中(文件位置:/e/class/userfun.php)
  1. function user_PhotoMorepic($tempid){
  2.     global $navinfor,$public_r;
  3.     $morepic=$navinfor['morepic'];
  4.     $rexp="\r\n";
  5.     $fexp="::::::";
  6.     $rstr="";
  7.     $sdh="";
  8.     $w_morepic="";
  9.     $rr=explode($rexp,$morepic);
  10.     $count=count($rr);
  11.     $num=$count;
  12.    
  13.     //取得模板
  14.     $tr=sys_ReturnBqTemp($tempid);
  15.     if(empty($tr['tempid']))
  16.     {return "";}
  17.     $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  18.     $subnews=$tr[subnews];
  19.     $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  20.     $rownum=$tr[rownum];
  21.     $formatdate=$tr[showdate];
  22.     if(empty($rownum))
  23.     {$rownum=1;}
  24.    
  25.     //列表
  26.     $list_exp="[!--empirenews.listtemp--]";
  27.     $list_r=explode($list_exp,$listtemp);
  28.     $listtext=$list_r[1];
  29.     $no=1;
  30.     $changerow=1;
  31.    
  32.     for($i=0;$i<$count;$i++)
  33.     {
  34.         $fr=explode($fexp,$rr[$i]);
  35.         $smallpic=$fr[0]?$fr[0]:$public_r[newsurl]."e/data/images/notimg.gif";    //小图
  36.         $bigpic=$fr[1]?$fr[1]:$public_r[newsurl]."e/data/images/notimg.gif";    //大图
  37.         if(empty($bigpic))
  38.         {
  39.             $bigpic=$smallpic;
  40.         }
  41.         $picname=htmlspecialchars($fr[2]);    //名称
  42.         $val[picname]=$picname;
  43.         $val[bigpic]=$bigpic;
  44.         $val[smallpic]=$smallpic;
  45.         /////////////////
  46.         $strF=",picname,bigpic,smallpic,";
  47.         $repvar=user_ReplaceShowpicsVars($listvar,$strF,$val,$no);
  48.         $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  49.         $changerow+=1;
  50.         //超过行数
  51.         if($changerow>$rownum)
  52.         {
  53.         $changerow=1;
  54.         $string.=$listtext;
  55.         $listtext=$list_r[1];
  56.         }
  57.         $no++;
  58.     }
  59.    $string=$list_r[0].$string.$list_r[2];
  60.     echo $string;
  61. }

  62. function user_ReplaceShowpicsVars($listtemp,$strF,$val,$no){
  63. $fr=explode(',',$strF);
  64. $fcount=count($fr)-1;;
  65. for($i=1;$i<$fcount;$i++)
  66. {
  67. $f=$fr[$i];
  68. $value=$val[$f];
  69. $listtemp=str_replace('[!--'.$f.'--]',$value,$listtemp);
  70. }
  71. $listtemp=str_replace('[!--no.num--]',$no,$listtemp);

  72. return $listtemp;
  73. }
复制代码
2、添加标签
标签名:图集
标签符号:pichd
函数名:user_PhotoMorepic
标签格式:[pichd]tempid[/pichd]
(tempid为模板标签id)
3、标签模板:
页面模板内容:
列表头[!--empirenews.listtemp--]列表内容[!--empirenews.listtemp--]列表尾
列表内容模板(list.var)
[!--picname--] 图片说明(标题)
[!--smallpic--] 小图
[!--bigpic--] 大图
[!--no.num--] 序号
内容模板
[pichd]标签模板id[/pichd]





上一篇:【帝国cms】【sql语句】修改会员的登录次数
下一篇:帝国cms列表内容模板调用所有图集或固定图集方法
如无回复请发邮件