今天给客户解决问题,遇到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}]}
//说明:上述为有组图时组图,有产品图时显示产品图,都有时,都可显示,互不影响。
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。