zoukankan      html  css  js  c++  java
  • Smarty的模板中不允许PHP的代码?

    /******************************************************************************
     *                  Smarty的模板中不允许PHP的代码?
     * 说明:
     *     在将PHP的代码转换为Smarty的模板的过程中,遇到Smarty无法转换PHP代码的问题,
     * 原因是这个功能被禁止了,因为既然使用Smarty模板,那么PHP代码做的事情尽量放在
     * Controller那里,这样可读性会更高。
     *
     *                                         2017-3-13 深圳 南山平山村 曾剑锋
     *****************************************************************************/
    
    一、参考文档:
        1. Using PHP code in Smarty tpl FIle        
            http://stackoverflow.com/questions/7446851/using-php-code-in-smarty-tpl-file
        2. Using PHP inside Smarty template files [duplicate]
            http://stackoverflow.com/questions/14877736/using-php-inside-smarty-template-files
        3. How to add PHP code to .tpl file [duplicate]
            http://stackoverflow.com/questions/9601547/how-to-add-php-code-to-tpl-file
        4. Using PHP code in Smarty tpl FIle
            http://stackoverflow.com/questions/7446851/using-php-code-in-smarty-tpl-file
        5. Difference between Smarty and SmartyBC classes
            http://stackoverflow.com/questions/35863410/difference-between-smarty-and-smartybc-classes
    
    二、原因:
        1. SmartyBC is a Backwards Compatibility Wrapper. it allows {php} and {include_php} inside templates. Both tags were dropped with the Smarty 3.1 release.
        2. You shouldn't add PHP code to the template. It will make whole idea of templates spoiled. You have to add PHP code to controller, not template.
    
        
  • 相关阅读:
    nopCommerce添加支付插件
    nopCommerce的配置以及汉化
    面试题-螺旋矩阵
    Eratosthenes筛选法
    rtp传输音视频(纯c代码)
    ts文件分析(纯c解析代码)
    h265文件分析(纯c解析代码)
    mpeg4文件分析(纯c解析代码)
    flv文件解析(纯c解析代码)
    mpeg2文件分析(纯c解析代码)
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/6542338.html
Copyright © 2011-2022 走看看