本文整理汇总了PHP中smarty::registerObject方法的典型用法代码示例。如果您正苦于以下问题:PHP smarty::registerObject方法的具体用法?PHP smarty::registerObject怎么用?PHP smarty::registerObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smarty
的用法示例。
在下文中一共展示了smarty::registerObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty
public static function smarty()
{
$instance = self::getInstance();
$conf = self::conf();
if (!isset($instance->smarty) || $instance->smarty === null) {
include_once $conf->root_dir . '/system/lib/Smarty/libs/Smarty.class.php';
$smartyConnection = new \smarty();
$smartyConnection->template_dir = $conf->root_dir . '/temp/templates/';
$smartyConnection->compile_dir = $conf->root_dir . '/temp/templates_c/';
$smartyConnection->config_dir = $conf->root_dir . '/temp/configs/';
$smartyConnection->cache_dir = $conf->root_dir . '/temp/cache/';
$smartyConnection->debugging = $conf->smarty_debug;
$smartyConnection->caching = TRUE;
$smartyConnection->cache_lifetime = 30;
$smartyConnection->plugins_dir = $conf->root_dir . '/system/lib/Smarty/libs/plugins';
$smartyConnection->compile_check = TRUE;
$smartyConnection->force_compile = TRUE;
$smartyConnection->registerObject('db', self::db());
$smartyConnection->registerResource('template', array('smarty_resource_template_source', 'smarty_resource_template_timestamp', 'smarty_resource_template_secure', 'smarty_resource_template_trusted'));
$smartyConnection->registerResource('data', array('smarty_resource_data_source', 'smarty_resource_data_timestamp', 'smarty_resource_data_secure', 'smarty_resource_data_trusted'));
return $instance->smarty = $smartyConnection;
} else {
return $instance->smarty;
}
}