本文整理汇总了PHP中Smarty::setConfigDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::setConfigDir方法的具体用法?PHP Smarty::setConfigDir怎么用?PHP Smarty::setConfigDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::setConfigDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeView
/**
* Initialize the view
* Require the class to have an instance of the provider
*
* @param string $templateFolder Optional template folder to use instead of the default /frontend/module/views/
* @return Viewable
*/
protected function initializeView($templateFolder = null)
{
if (!$this->view) {
$this->view = new \Smarty();
$configuration = $this->getConfiguration();
$appFolder = $configuration->get('system.app.folder');
if ($templateFolder === null) {
$module = $this->getModuleFromNamespace();
$templateFolder = $appFolder . '/frontend/' . $module . '/views/';
}
// setup the template folder
$this->view->setTemplateDir($templateFolder);
// setup the temporary folders
$tempFolder = $configuration->get('system.temp.folder');
$this->view->setCompileDir($this->checkWritable($tempFolder . '/smarty_compiled/'));
$this->view->setCacheDir($this->checkWritable($tempFolder . '/smarty_cache/'));
$this->view->setConfigDir($this->checkWritable($tempFolder . '/smarty_config/'));
// add all the plugin folders to the view
foreach ($configuration->get('view.plugin.folders', array()) as $pluginFolder) {
$this->view->addPluginsDir($pluginFolder);
}
$this->view->addPluginsDir($appFolder . '/../vendor/mystlabs/mistyforms/src/MistyForms/smarty_plugins');
$this->view->addPluginsDir($appFolder . '/../vendor/mystlabs/mistyapp/src/MistyApp/smarty_plugins');
// if we are in development mode we want to regenerate the views at every render
if ($configuration->get('system.development.mode', false)) {
$this->view->compile_check = true;
$this->view->force_compile = true;
}
}
return $this;
}
示例2: __construct
public function __construct()
{
@session_start();
$this->smarty = new Smarty();
$this->smarty->setTemplateDir(realpath('../install/templates/'));
$this->smarty->setCompileDir(nZEDb_LIBS . 'smarty/templates_c/');
$this->smarty->setConfigDir(nZEDb_LIBS . 'smarty/configs/');
$this->smarty->setCacheDir(nZEDb_LIBS . 'smarty/cache/');
}
示例3: __construct
/**
* Constructor del nucleo
*
* Inicializa el objeto smarty y guarda los parametros
*
*/
private function __construct()
{
//Cargar Smarty Principal y su configuraci�n
$this->smarty = new Smarty();
$dirabs = "http://" . dirname($_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
$this->smarty->setTemplateDir('app/vistas/');
$this->smarty->setCompileDir('tmp/templates_c/');
$this->smarty->setConfigDir('app/configuracion/');
$this->smarty->setCacheDir('tmp/cache/');
$this->smarty->assign("publico", $dirabs . '/app/publico');
$this->smarty->caching = false;
$this->parametros = $_REQUEST;
$this->get = $_GET;
$this->post = $_POST;
}
示例4: prepareSmartyObject
private static function prepareSmartyObject()
{
self::$smarty = new Smarty();
self::$smarty->setTemplateDir(HOME_DIR . '/templates/' . app::get('template') . '/');
self::$smarty->setCompileDir(HOME_DIR . '/templates_c/');
self::$smarty->setConfigDir(HOME_DIR . '/configs/');
self::$smarty->setCacheDir(HOME_DIR . '/cache/');
self::$smarty->force_compile = true;
self::$smarty->debugging = \app::get('debug');
self::$smarty->caching = true;
self::$smarty->cache_lifetime = 120;
foreach (self::$assign as $key => $value) {
self::$smarty->assign($key, $value);
}
}
示例5: evaluatePath
/**
* Get the evaluated contents of the view at the given path.
*
* @param string $path
* @param array $data
* @return string
*/
protected function evaluatePath($__path, $__data)
{
$caching = $this->config('caching');
$cache_lifetime = $this->config('cache_lifetime');
$debugging = $this->config('debugging');
$template_path = $this->config('template_path');
$compile_path = $this->config('compile_path');
$cache_path = $this->config('cache_path');
$plugins_paths = (array) $this->config('plugins_paths');
$config_paths = (array) $this->config('config_paths');
$escape_html = $this->config('escape_html', false);
// Create smarty object.
$smarty = new \Smarty();
$smarty->setTemplateDir($template_path);
$smarty->setCompileDir($compile_path);
$smarty->setCacheDir($cache_path);
foreach ($plugins_paths as $path) {
$smarty->addPluginsDir($path);
}
foreach ($config_paths as $path) {
$smarty->setConfigDir($path);
}
$smarty->debugging = $debugging;
$smarty->caching = $caching;
$smarty->cache_lifetime = $cache_lifetime;
$smarty->compile_check = true;
// set the escape_html flag from the configuration value
//
$smarty->escape_html = $escape_html;
$smarty->error_reporting = E_ALL & ~E_NOTICE;
foreach ($__data as $var => $val) {
$smarty->assign($var, $val);
}
return $smarty->fetch($__path);
}
示例6: rx_set_smarty_paths
function rx_set_smarty_paths(Smarty $viewModel)
{
$viewModel->setTemplateDir(app\service\Smarty::$VIEW_PATH);
$viewModel->setConfigDir(CONFIG_PATH);
$CACHE_PATH = BUILD_PATH . 'smarty_cache';
if (!file_exists($CACHE_PATH)) {
if (!mkdir($CACHE_PATH, 0777, true)) {
die('Failed to create folders:' . $CACHE_PATH);
}
}
$viewModel->setCacheDir($CACHE_PATH);
$TEMP_PATH = BUILD_PATH . 'smarty_temp';
if (!file_exists($TEMP_PATH)) {
if (!mkdir($TEMP_PATH, 0777, true)) {
die('Failed to create folders:' . $TEMP_PATH);
}
}
$viewModel->setCompileDir($TEMP_PATH);
$LOCAL_PLUGIN_PATH = APP_PATH . "SMARTY_PLUGINS";
if (file_exists($LOCAL_PLUGIN_PATH)) {
$viewModel->addPluginsDir($LOCAL_PLUGIN_PATH);
}
foreach (app\service\Smarty::$PLUGINS_DIR as $path) {
$viewModel->addPluginsDir($path);
}
}
示例7: initTemplate
/**
* initTemplate($tmpl_path = '', array $options = [ ], array $extres = [ ])
*
* テンプレートエンジンのインスタンスを生成する
*
* @access private
*
* @param string $tmpl_path テンプレートファイルが格納されているディレクトリのパス
* @param array $options Smartyに引き渡すオプション
* @param array $extres 外部リソースの定義
*
* @return object テンプレートエンジンのインスタンス
*/
private function initTemplate($tmpl_path = '', array $options = ['cache' => ['mode' => \Smarty::CACHING_LIFETIME_SAVED, 'lifetime' => 3600, 'modified_check' => true], 'compile' => ['check' => true, 'force' => false], 'debug' => ['enable' => false, 'ctrl' => 'NONE']], array $extres = [])
{
// テンプレートパスをアプリケーション格納フォルダ配下に限定
$tmpl_path = str_replace(DS . DS, DS, RISOLUTO_APPS . 'RisolutoApps/' . str_replace('../', '', $tmpl_path));
// テンプレートエンジン関連定義(Smartyを使用)
$tmpl = new \Smarty();
//--- テンプレートキャッシュの設定
$tmpl->setCacheDir(RISOLUTO_CACHE);
$tmpl->caching = isset($options['cache']['mode']) ? $options['cache']['mode'] : \Smarty::CACHING_LIFETIME_SAVED;
$tmpl->cache_lifetime = isset($options['cache']['lifetime']) ? $options['cache']['lifetime'] : 3600;
$tmpl->cache_modified_check = isset($options['cache']['modified_check']) ? $options['cache']['modified_check'] : true;
//--- コンパイル済みテンプレートの設定
$tmpl->setCompileDir(RISOLUTO_CACHE);
$tmpl->compile_check = isset($options['compile']['check']) ? $options['compile']['check'] : true;
$tmpl->force_compile = isset($options['compile']['force']) ? $options['compile']['force'] : false;
//--- テンプレート用コンフィグファイルの設定
$tmpl->setConfigDir($tmpl_path);
//--- テンプレートのデバッグ設定
$tmpl->debugging = isset($options['debug']['enable']) ? $options['debug']['enable'] : false;
$tmpl->debugging_ctrl = isset($options['debug']['ctrl']) ? $options['debug']['ctrl'] : 'NONE';
//--- テンプレートファイルのパス
$tmpl->setTemplateDir($tmpl_path);
// 外部リソースの登録
if (isset($extres)) {
foreach ($extres as $dat) {
if (isset($dat['name']) and isset($dat['class'])) {
$tmpl->register_resource($dat['name'], [$dat['class'], 'getTemplate', 'getTimeStamp', 'getSecure', 'getTrusted']);
}
}
}
return $tmpl;
}
示例8: execute
function execute()
{
Load::file('Smarty.class.php', $this->source_dir);
$smarty = new Smarty();
$smarty->setCompileDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'templates_c') . DS);
$smarty->setConfigDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'configs') . DS);
$smarty->setCacheDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'cache') . DS);
return $smarty;
}
示例9: initSmarty
function initSmarty()
{
$smarty = new Smarty();
$smarty->setTemplateDir(__SITEPATH__ . '/smarty/templates');
$smarty->setCompileDir(__SITEPATH__ . '/smarty/templates_c');
$smarty->setCacheDir(__SITEPATH__ . '/smarty/cache');
$smarty->setConfigDir(__SITEPATH__ . '/smarty/configs');
return $smarty;
}
示例10: setup_smarty
function setup_smarty()
{
$smarty = new Smarty();
$smarty->setTemplateDir('templates/');
$smarty->setCompileDir('libs/smarty/templates_c/');
$smarty->setConfigDir('libs/smarty/configs/');
$smarty->setCacheDir('libs/smarty/cache/');
return $smarty;
}
示例11: loadSmarty
public static function loadSmarty()
{
$smarty = new Smarty();
// var_dump($smarty);
$smarty->setTemplateDir(APPLICATION_PATH . 'smarty/templates');
$smarty->setCompileDir(APPLICATION_PATH . 'smarty/templates_c');
$smarty->setCacheDir(APPLICATION_PATH . 'smarty/cache');
$smarty->setConfigDir(APPLICATION_PATH . 'smarty/configs');
return $smarty;
}
示例12: setSmarty
function setSmarty()
{
global $SMARTY;
$view = new Smarty();
$view->setTemplateDir($SMARTY[0]['template']);
$view->setCompileDir($SMARTY[0]['logs']);
$view->setCacheDir($SMARTY[0]['cache']);
$view->setConfigDir($SMARTY[0]['config']);
return $view;
}
示例13: GetTemplate
public static function GetTemplate()
{
$smarty = new Smarty();
$smarty->setTemplateDir(TEMPLATE_PATH);
$smarty->setCompileDir(COMPILE_PATH);
$smarty->setConfigDir(CONF_PATH);
$smarty->setCacheDir(CACHE_PATH);
$smarty->addPluginsDir(TEMPLATE_PLUGINS_PATH);
return $smarty;
}
示例14: setUp
public function setUp()
{
$view = new \Smarty();
$view->setTemplateDir(SMARTY_TMP_FOLDER);
$view->setCompileDir(SMARTY_TMP_FOLDER);
$view->setConfigDir(SMARTY_TMP_FOLDER);
$view->setCacheDir(SMARTY_TMP_FOLDER);
$view->addPluginsDir(__DIR__ . '/../../smarty_plugins/');
$view->compile_check = true;
$this->smarty = $view;
}
示例15: getSmarty
public static function getSmarty()
{
$rootDir = dirname(__FILE__);
require_once $rootDir . "/smarty/Smarty.class.php";
$smarty = new Smarty();
$smarty->setTemplateDir($rootDir . "/smarty/templates");
$smarty->setCacheDir($rootDir . "/working_temp/cache");
$smarty->setCompileDir($rootDir . "/working_temp/templates_c");
$smarty->setConfigDir($rootDir . "/working_temp/configs");
return $smarty;
}