博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
magento--------------输出content前字符过滤处理,现在字母个数处理
阅读量:4200 次
发布时间:2019-05-26

本文共 940 字,大约阅读时间需要 3 分钟。

1.
   public function getContent($limit = 0)
    {
        //process page
        $helper = Mage::helper('cms');
        $processor = $helper->getPageTemplateProcessor();
        $html = $processor->filter($this->getData("content"));
        if($limit)
            return $this->html_cut_text($this->strip_html_tags($html), $limit);
        else
               return ($html);
    }
   
2.
//是一个过滤函数。
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($this->getData("content"));
2.1
 public function getPageTemplateProcessor()
    {
        $model = (string)Mage::getConfig()->getNode(self::XML_NODE_PAGE_TEMPLATE_FILTER);
        return Mage::getModel($model);
    }
2.1.1
const XML_NODE_PAGE_TEMPLATE_FILTER     = 'global/cms/page/tempate_filter';
2.1.2
<global>
  <cms>
       <page>
          <tempate_filter>cms/template_filter</tempate_filter>
       </page>
  </cms>
</global>
//故Mage::getModel($model)得到的是Mage/cms/model/template/filter.php
3.
//处理内容,如果$limit为100,则抓取前面100个字母,用于简介等内容实用
return $this->html_cut_text($this->strip_html_tags($html), $limit);

转载地址:http://lwcli.baihongyu.com/

你可能感兴趣的文章
magento - 通过storeid,分类id,天数(几天内)得到产品
查看>>
一个很不错的bash脚本编写教程,至少没接触过BASH的也能看懂!
查看>>
Redis和Memcache对比及选择
查看>>
用谷歌账号登陆magento、
查看>>
php oauth 模块在linux下安装
查看>>
代替nginx的服务器 - The Tengine Web Server
查看>>
nginx 升级成 tengine 的代码
查看>>
magento rest api 调用
查看>>
magento rest api 调用!
查看>>
magento rest api get Token key and secret
查看>>
谷歌获取货币汇率代码
查看>>
安装nginx
查看>>
手动6 - 隐藏Nginx版本号
查看>>
手动7 - nginx 日志切割
查看>>
magento - 使用后台设置的时间用法
查看>>
Linux常用命令
查看>>
清除文件中的.svn文件
查看>>
手动11 -nginx 优化配置
查看>>
php加速器 - zendopcache
查看>>
手动12 - 安装php加速器 Zend OPcache
查看>>