栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

php封装的smartyBC类完整实例

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

php封装的smartyBC类完整实例

本文实例讲述了php封装的smartyBC类。分享给大家供大家参考,具体如下:

registerPlugin('block', 'php', 'smarty_php_tag');
  }
  
  public function assign_by_ref($tpl_var, &$value)
  {
    $this->assignByRef($tpl_var, $value);
  }
  
  public function append_by_ref($tpl_var, &$value, $merge = false)
  {
    $this->appendByRef($tpl_var, $value, $merge);
  }
  
  public function clear_assign($tpl_var)
  {
    $this->clearAssign($tpl_var);
  }
  
  public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
  {
    $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
  }
  
  public function unregister_function($function)
  {
    $this->unregisterPlugin('function', $function);
  }
  
  public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
  {
    settype($allowed, 'array');
    settype($smarty_args, 'boolean');
    $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
  }
  
  public function unregister_object($object)
  {
    $this->unregisterObject($object);
  }
  
  public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
  {
    $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
  }
  
  public function unregister_block($block)
  {
    $this->unregisterPlugin('block', $block);
  }
  
  public function register_compiler_function($function, $function_impl, $cacheable = true)
  {
    $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
  }
  
  public function unregister_compiler_function($function)
  {
    $this->unregisterPlugin('compiler', $function);
  }
  
  public function register_modifier($modifier, $modifier_impl)
  {
    $this->registerPlugin('modifier', $modifier, $modifier_impl);
  }
  
  public function unregister_modifier($modifier)
  {
    $this->unregisterPlugin('modifier', $modifier);
  }
  
  public function register_resource($type, $functions)
  {
    $this->registerResource($type, $functions);
  }
  
  public function unregister_resource($type)
  {
    $this->unregisterResource($type);
  }
  
  public function register_prefilter($function)
  {
    $this->registerFilter('pre', $function);
  }
  
  public function unregister_prefilter($function)
  {
    $this->unregisterFilter('pre', $function);
  }
  
  public function register_postfilter($function)
  {
    $this->registerFilter('post', $function);
  }
  
  public function unregister_postfilter($function)
  {
    $this->unregisterFilter('post', $function);
  }
  
  public function register_outputfilter($function)
  {
    $this->registerFilter('output', $function);
  }
  
  public function unregister_outputfilter($function)
  {
    $this->unregisterFilter('output', $function);
  }
  
  public function load_filter($type, $name)
  {
    $this->loadFilter($type, $name);
  }
  
  public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
  {
    return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
  }
  
  public function clear_all_cache($exp_time = null)
  {
    return $this->clearCache(null, null, null, $exp_time);
  }
  
  public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
  {
    return $this->isCached($tpl_file, $cache_id, $compile_id);
  }
  
  public function clear_all_assign()
  {
    $this->clearAllAssign();
  }
  
  public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
  {
    return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
  }
  
  public function template_exists($tpl_file)
  {
    return $this->templateExists($tpl_file);
  }
  
  public function get_template_vars($name = null)
  {
    return $this->getTemplateVars($name);
  }
  
  public function get_config_vars($name = null)
  {
    return $this->getConfigVars($name);
  }
  
  public function config_load($file, $section = null, $scope = 'global')
  {
    $this->ConfigLoad($file, $section, $scope);
  }
  
  public function get_registered_object($name)
  {
    return $this->getRegisteredObject($name);
  }
  
  public function clear_config($var = null)
  {
    $this->clearConfig($var);
  }
  
  public function trigger_error($error_msg, $error_type = E_USER_WARNING)
  {
    trigger_error("Smarty error: $error_msg", $error_type);
  }
}

function smarty_php_tag($params, $content, $template, &$repeat)
{
  eval($content);
  return '';
}

更多关于Smarty相关内容感兴趣的读者可查看本站专题:《smarty模板入门基础教程》、《PHP模板技术总结》、《PHP基于pdo操作数据库技巧总结》、《PHP运算与运算符用法总结》、《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于smarty模板的PHP程序设计有所帮助。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/42310.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号