本文整理汇总了PHP中Smarty::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::__construct方法的具体用法?PHP Smarty::__construct怎么用?PHP Smarty::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct
*/
public function __construct()
{
parent::__construct();
$this->JSRMS = new JSRMS();
$this->JSRMS->requireResource('system');
$this->muteExpectedErrors();
$this->setCacheDir(SYSTEM_ROOT . '/classes/smarty/cache/');
$this->setCompileDir(SYSTEM_ROOT . '/classes/smarty/templates_c/');
$this->setTemplateDir(SYSTEM_ROOT . '/view/');
$this->registerObject('Router', Router::getInstance(), array('build'), false);
$this->registerObject('L10N', System::getLanguage(), array('_'), false);
$this->assign('LoggedIn', System::getUser() != NULL);
$this->assign('User', System::getUser());
$this->assign('Navigation', Navigation::$elements);
$this->assign('LangStrings', System::getLanguage()->getAllStrings());
// Configuration
$this->assign('HTTP_BASEDIR', System::getBaseURL());
$this->assign('MOD_REWRITE', MOD_REWRITE);
$this->assign('MAX_UPLOAD_SIZE', Utils::maxUploadSize());
if (System::getSession()->getData('successMsg', '') != '') {
$this->assign('successMsg', System::getSession()->getData('successMsg', ''));
System::getSession()->setData('successMsg', '');
}
if (System::getSession()->getData('errorMsg', '') != '') {
$this->assign('errorMsg', System::getSession()->getData('errorMsg', ''));
System::getSession()->setData('errorMsg', '');
}
if (System::getSession()->getData('infoMsg', '') != '') {
$this->assign('infoMsg', System::getSession()->getData('infoMsg', ''));
System::getSession()->setData('infoMsg', '');
}
}
示例2: array
function Smarty_Serweb()
{
global $config, $_SERWEB;
// Smarty does not support "magic_quotes_runtime" enabled
// So make sure to disable it.
ini_set("magic_quotes_runtime", 0);
// Class Constructor. These automatically get set with each new instance.
parent::__construct();
//set smarty directories
$this->template_dir = array($_SERWEB["templatesdir"]);
if ($_SERWEB["templatesdir"] != $_SERWEB["coretemplatesdir"]) {
$this->template_dir[] = $_SERWEB["coretemplatesdir"];
}
$this->config_dir = $_SERWEB["templatesdir"] . 'configs/';
$this->cache_dir = $_SERWEB["templatesdir"] . 'cache/';
$this->plugins_dir = array();
if (!empty($_SERWEB["smartypluginsdir"])) {
$this->plugins_dir[] = $_SERWEB["smartypluginsdir"];
}
$this->plugins_dir[] = $_SERWEB["corefunctionsdir"] . "smarty_plugins/";
$this->plugins_dir[] = $_SERWEB["smartydir"] . "plugins/";
if (!empty($config->smarty_compile_dir)) {
RecursiveMkdir($config->smarty_compile_dir);
$this->compile_dir = $config->smarty_compile_dir;
} else {
$this->compile_dir = $_SERWEB["templatesdir"] . 'templates_c/';
}
}
示例3: __construct
public function __construct()
{
parent::__construct();
if (!file_exists(SUGAR_SMARTY_DIR)) {
mkdir_recursive(SUGAR_SMARTY_DIR, true);
}
if (!file_exists(SUGAR_SMARTY_DIR . 'templates_c')) {
mkdir_recursive(SUGAR_SMARTY_DIR . 'templates_c', true);
}
if (!file_exists(SUGAR_SMARTY_DIR . 'configs')) {
mkdir_recursive(SUGAR_SMARTY_DIR . 'configs', true);
}
if (!file_exists(SUGAR_SMARTY_DIR . 'cache')) {
mkdir_recursive(SUGAR_SMARTY_DIR . 'cache', true);
}
$this->template_dir = '.';
$this->compile_dir = SUGAR_SMARTY_DIR . 'templates_c';
$this->config_dir = SUGAR_SMARTY_DIR . 'configs';
$this->cache_dir = SUGAR_SMARTY_DIR . 'cache';
$this->request_use_auto_globals = true;
// to disable Smarty from using long arrays
if (file_exists('custom/include/Smarty/plugins')) {
$plugins_dir[] = 'custom/include/Smarty/plugins';
}
$plugins_dir[] = 'include/Smarty/plugins';
$this->plugins_dir = $plugins_dir;
$this->assign("VERSION_MARK", getVersionedPath(''));
}
示例4: __construct
/**
* [__construct 构造方法自动运行]
*/
public function __construct()
{
parent::__construct();
$this->setTemplateDir($this->template_dir);
$this->setCompileDir($this->compile_dir);
// $this->caching = Smarty::CACHING_LIFETIME_CURRENT;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->addTemplateDir(CFG_dir . 'p/tpl/');
$this->compile_dir = CFG_dir . 'tmp/tpl_c';
$this->plugins_dir = CFG_dir . 'p/libs/plugins/';
}
示例6: __construct
public function __construct()
{
// Class Constructor. These automatically get set with each new instance.
parent::__construct();
// call the objects initialization parameters
self::setParams();
}
示例7: __construct
public function __construct($smConf = array(), $filter = true)
{
parent::__construct();
if (count($smConf) == 0) {
$smConf = Piwik_Config::getInstance()->smarty;
}
foreach ($smConf as $key => $value) {
$this->{$key} = $value;
}
$this->template_dir = $smConf['template_dir'];
array_walk($this->template_dir, array("Piwik_Smarty", "addPiwikPath"), PIWIK_INCLUDE_PATH);
$this->plugins_dir = $smConf['plugins_dir'];
array_walk($this->plugins_dir, array("Piwik_Smarty", "addPiwikPath"), PIWIK_INCLUDE_PATH);
$this->compile_dir = $smConf['compile_dir'];
Piwik_Smarty::addPiwikPath($this->compile_dir, null, PIWIK_USER_PATH);
$this->cache_dir = $smConf['cache_dir'];
Piwik_Smarty::addPiwikPath($this->cache_dir, null, PIWIK_USER_PATH);
$error_reporting = $smConf['error_reporting'];
if ($error_reporting != (string) (int) $error_reporting) {
$error_reporting = self::bitwise_eval($error_reporting);
}
$this->error_reporting = $error_reporting;
if ($filter) {
$this->load_filter('output', 'cachebuster');
$use_ajax_cdn = Piwik_Config::getInstance()->General['use_ajax_cdn'];
if ($use_ajax_cdn) {
$this->load_filter('output', 'ajaxcdn');
}
$this->load_filter('output', 'trimwhitespace');
}
}
示例8:
function __construct($root = ".")
{
parent::__construct();
if (!empty($root)) {
$this->Init($root);
}
}
示例9: __construct
public function __construct(Request $peticion, Acl $_acl)
{
parent::__construct();
$this->_controlador = $peticion->getControlador();
$this->_js = array();
$this->_acl = $_acl;
}
示例10: __construct
/**
* Constructor. Inherits all methods from Smarty.
*/
public function __construct()
{
parent::__construct();
// Paths definition:
$templates_path = ROOT_PATH . '/instances/' . Bootstrap::$instance . '/templates/';
$this->setTemplateDir(ROOT_PATH . '/');
// The templates are taken using the templates.config.php mappings, under the variable $_tpls.
$this->setCompileDir($templates_path . '_smarty/compile/');
$this->setConfigDir($templates_path . '_smarty/configs/');
$this->setCacheDir($templates_path . '_smarty/cache/');
// Get the instances inheritance.
$instance_inheritance = \Sifo\Domains::getInstance()->getInstanceInheritance();
// If there is inheritance.
if (is_array($instance_inheritance)) {
// First the child instance, last the parent instance.
$instance_inheritance = array_reverse($instance_inheritance);
foreach ($instance_inheritance as $current_instance) {
$this->addPluginsDir(ROOT_PATH . '/instances/' . $current_instance . '/templates/' . '_smarty/plugins');
}
} else {
$this->addPluginsDir($templates_path . '_smarty/plugins');
}
// Last path is the default smarty plugins directory.
$this->addPluginsDir(ROOT_PATH . '/libs/Smarty-sifo-plugins');
// Set this to false to avoid magical parsing of literal blocks without the {literal} tags.
$this->auto_literal = false;
}
示例11: __construct
public function __construct()
{
parent::__construct();
// Store the Codeigniter super global instance... whatever
$this->CI = get_instance();
// $this->CI->load->config('smarty');
//
// $this->template_dir = $this->CI->config->item('template_directory');
// $this->compile_dir = $this->CI->config->item('compile_directory');
// $this->cache_dir = $this->CI->config->item('cache_directory');
// $this->config_dir = $this->CI->config->item('config_directory');
// $this->template_ext = $this->CI->config->item('template_ext');
$this->template_dir = $this->CI->config->item('template_dir');
$this->compile_dir = $this->CI->config->item('compile_dir');
$this->cache_dir = $this->CI->config->item('cache_dir');
$this->config_dir = $this->CI->config->item('config_dir');
$this->template_ext = $this->CI->config->item('template_ext');
$this->exception_handler = null;
// Add all helpers to plugins_dir
$helpers = glob(APPPATH . 'helpers/', GLOB_ONLYDIR | GLOB_MARK);
foreach ($helpers as $helper)
{
$this->plugins_dir[] = $helper;
}
// Should let us access Codeigniter stuff in views
$this->assign("this", $this->CI);
}
示例12: __construct
public function __construct()
{
parent::__construct();
$ds = '/';
$module = MODULE_NAME;
$leftDelimiter = \Pandaphp::shell('Config::get', 'template_smarty_left_delimiter');
$this->left_delimiter = $leftDelimiter;
$rightDelimiter = \Pandaphp::shell('Config::get', 'template_smarty_right_delimiter');
$this->right_delimiter = $rightDelimiter;
// 设置模板文件目录
$viewDirname = \Pandaphp::shell('Config::get', 'dirname_view');
$theme = \Pandaphp::shell('Config::get', 'template_theme');
$theme = $theme ? $theme . $ds : '';
$templateDir = \Pandaphp::get('appPath') . $module . $ds . $viewDirname . $ds . $theme;
$this->setTemplateDir($templateDir);
// 设置编译后的模板文件目录]
$runtimeDir = \Pandaphp::get('runtimePath');
$compileDir = $runtimeDir . $module . $ds . 'template_complie' . $ds;
$this->setCompileDir($compileDir);
// 设置缓存的模板文件目录
$cacheDir = $runtimeDir . $module . $ds . 'template_cache' . $ds;
$this->setCacheDir($cacheDir);
$isTemplateCache = \Pandaphp::shell('Config::get', 'template_cache_on');
$this->setCaching($isTemplateCache);
$templateCacheLifetime = \Pandaphp::shell('Config::get', 'template_cache_lifetime');
$this->setCacheLifetime($templateCacheLifetime);
}
示例13: __construct
public function __construct()
{
parent::__construct();
// It is not recommended to put these directories under the web server document root
$this->setTemplateDir(DOCUMENT_ROOT . '/view/templates/');
$this->setCompileDir(DOCUMENT_ROOT . '/view/templates_c/');
$this->setCacheDir(DOCUMENT_ROOT . '/view/cache/');
$this->setConfigDir(DOCUMENT_ROOT . '/view/configs/');
$this->configLoad('paths.conf');
$this->compile_check = false;
// put to false for maximal performance when it is into production
$this->force_compile = false;
// should never be used in a production environment
$this->debugging = false;
//$this->debugging_ctrl = ($_SERVER['SERVER_NAME'] == 'localhost')
$this->caching = 0;
$this->cache_lifetime = 0;
// Delimiters in HTML codes
$this->left_delimiter = '{';
$this->right_delimiter = '}';
// Delimiters in JavaScript codes
//$this->left_delimiter = '<!--{';
//$this->right_delimiter = '}-->';
$this->assign('app_name', 'HEHLan');
}
示例14: array
/**
* needs a proper description
* @param string $tikidomain
*/
function Smarty_Tiki($tikidomain = '')
{
parent::__construct();
global $prefs, $style_base;
$this->initializePaths();
$this->setConfigDir(null);
if (!isset($prefs['smarty_compilation'])) {
$prefs['smarty_compilation'] = '';
}
$this->compile_check = $prefs['smarty_compilation'] != 'never';
$this->force_compile = $prefs['smarty_compilation'] == 'always';
$this->assign('app_name', 'Tiki');
$this->setPluginsDir(array(TIKI_SMARTY_DIR, SMARTY_DIR . 'plugins'));
if (!isset($prefs['smarty_security']) || $prefs['smarty_security'] == 'y') {
$this->enableSecurity('Tiki_Security_Policy');
} else {
$this->disableSecurity();
}
$this->use_sub_dirs = false;
$this->url_overriding_prefix_stack = array();
if (!empty($prefs['smarty_notice_reporting']) and $prefs['smarty_notice_reporting'] === 'y') {
$this->error_reporting = E_ALL;
} else {
$this->error_reporting = E_ALL ^ E_NOTICE;
}
$this->setCompileDir(realpath("templates_c"));
}
示例15: __construct
/**
* Constructor
* @param string $template [optional] : name of the template to load (without the .tpl)
* @param array $info [optional default Array()] : array containing page's meta informations, title, cache, cache_version, etc...
* cach_lifetime : false or 0 to disactivate caching, null for default, or int to set cache lifetime
* Set cache_version if you want to separate cache into versions
*/
public function __construct($template = false, $info = array())
{
BF::register_error_output_callback(array($this, "show_error"));
// > Define runtime variables
parent::__construct();
$this->compile_check = BF::gc('template_compile_check');
$this->debugging = BF::gc('template_smarty_debug');
$this->template_dir = BF::gf('tpl')->path();
$this->compile_dir = BF::gf('compiled')->path();
$this->cache_dir = BF::gf('cached')->path();
$this->addPluginsDir(BF::gf('tags')->path());
$this->content_type = BF::gc('template_default_content_type');
$this->error_reporting = BF::gc('error_reporting');
// > Caching
// block for non-cachable content
$this->cache_lifetime = BF::gc('template_cache_lifetime');
$this->caching = BF::gc('template_cache') ? 1 : 0;
//$this->cache_version = null;
// > Register template infos
$this->data = array();
$this->assignByRef("_data", $this->data);
// > Register common template functions and blocks. Others will be found in the tags dir
$this->loadFilter('pre', 'translate');
// trim top and bottom
$this->registerFilter("output", create_function('$x', 'return trim($x);'));
if ($template !== false) {
$this->load($template, $info);
}
}