Chapter 13. Smarty成员变量

Table of Contents

$allow_php_templates
$auto_literal
$autoload_filters
$cache_dir
$cache_id
$cache_lifetime
$cache_locking
$cache_modified_check
$caching
$caching_type
$compile_check
$compile_dir
$compile_id
$compile_locking
$compiler_class
$config_booleanize
$config_dir
$config_overwrite
$config_read_hidden
$debug_tpl
$debugging
$debugging_ctrl
$default_config_type
$default_modifiers
$default_resource_type
$default_config_handler_func
$default_template_handler_func
$direct_access_security
$error_reporting
$escape_html
$force_cache
$force_compile
$left_delimiter
$locking_timeout
$merge_compiled_includes
$php_handling
$plugins_dir
$right_delimiter
$smarty_debug_id
$template_dir
$trusted_dir
$use_include_path
$use_sub_dirs

这里都是Smarty可用的成员变量。 你可以直接存取它们,或者使用相应的setter/getter方法。

Note

全部成员变量都有setter/getter的魔术方法。 和变量格式不一样的是,setter/getter方法都是用驼峰命名法。 例如,你可以使用$smarty->setTemplateDir($dir) 和 $dir = $smarty->getTemplateDir() 来存和取$smarty->template_dir变量。

Note

参见改变模板设置 来了解如何在模板中改变这些变量。

$allow_php_templates

默认PHP模板文件是不允许使用的。设置$allow_php_templates为true,则允许使用PHP模板文件。


<?php
$smarty->allow_php_templates = true;
?>

        

Note

PHP模板文件是一个不在文档中注明的废弃特性。