Pbootcms 内容页多图数量的调用和判断显示
今天给客户解决问题,遇到pbootcms内容页调用多图需要判断多图的数量,现对具体二开方案,做一个阐述:
修改文件:apps/home/controller/ParserController.php,大概在1598行下,增加代码:
case 'countnum':
$one_html = str_replace($matches2[0][$j], count($pics), $one_html);
break;
//相当于给pics标签增加了一个countnum字段,用来统计
模板文件view_*.html,修改如下:
{"path":"{content:ico}","smallPath":"{content:ico}","bigH":null,"bigW":null,"srcBigPic":"{content:ico}","smallH":30,"smallW":38,"title":"{content:title}"}{pboot:if({content:ispics}==1)},{/pboot:if}{pboot:pics id={content:id} num=5}{"path":"[pics:src]","smallPath":"[pics:src]","bigH":null,"bigW":null,"srcBigPic":"[pics:src]","smallH":30,"smallW":38,"title":"[pics:title]"}{pboot:if([pics:i]!=[pics:countnum])},{/pboot:if}{/pboot:pics}]}
//说明:上述为有组图时组图,有产品图时显示产品图,都有时,都可显示,互不影响。