PbootCMS文章内容中系统标签的二次解析

PbootCMS框架下,系统的标签解析仅仅是基于模版的。如果在文章内容的源代码中,嵌入PbootCMS系统标签,PbootCMS并不能进行二次解析。如何实现PbootCMS文章内容系统标签的二次解析呢?根据PbootCMS解析原理,我们使用以下步骤:
1、在文章内容中任意位置添加用于二次解析的标记标签:{p boot:recontentparser}(重新内容解析);
2、找到
apps\home\controller\IndexController.php
文件,在第299行代码后添加以下代码:
if (!!strpos($content, "{p boot:recontentparser}")) {//二次解析CMS内容中的标签

            $content = str_replace("", "", $content);

            $content = $this->parser->parserPositionLabel($content, $sort->scode); // CMS当前位置标签解析

            $content = $this->parser->parserSortLabel($content, $sort); // CMS分类信息标签解析

            $content = $this->parser->parserCurrentContentLabel($content, $sort, $data); // CMS内容标签解析

            $content = $this->parser->parserCommentLabel($content); // 文章评论

            $content = $this->parser->parserAfter($content); // CMS公共标签后置解析

        }

请注意实际代码中删除标记标签{p boot:recontentparser}中的空格;

二次解析会自动增加文章访问量,如需准确的文章访问量,需要修改二次简析代码以减少访问量。




yxsoft -用心服务,我们注重产品的每一个细节。