本文整理汇总了PHP中Smarty::setLeftDelimiter方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::setLeftDelimiter方法的具体用法?PHP Smarty::setLeftDelimiter怎么用?PHP Smarty::setLeftDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::setLeftDelimiter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getView
public static function getView($key = 'default')
{
if (isset(self::$viewResMap[$key])) {
return self::$viewResMap[$Key];
}
require_once FILE . "/component/smarty-3.1.24/libs/Smarty.class.php";
$view = new Smarty();
$view->setTemplateDir(FILE . cfg_template::$template_dir . $key);
$view->setCompileDir(FILE . '/data/' . $key . cfg_template::$compile_dir);
$view->setCacheDir(FILE . '/data/' . $key . cfg_template::$cache_dir);
$view->setCaching(cfg_template::$caching);
$view->setLeftDelimiter(cfg_template::$left_delimiter);
$view->setRightDelimiter(cfg_template::$right_delimiter);
self::$viewResMap[$key] = $view;
return self::$viewResMap[$key];
}
示例2: render_smarty
function render_smarty($tpl = null, $data = array())
{
$root = dirname(__FILE__) . '/';
if (!$tpl) {
$path = $_SERVER['REQUEST_URI'];
$split = explode('/', $path);
$last = array_pop($split);
$len = count($split);
if (($pos = strpos($path, '?')) !== false) {
$path = substr($path, 0, $pos);
}
if (1 === $len) {
$path .= '/index.tpl';
} else {
$path .= '.tpl';
}
$tpl = $root . 'template' . $path;
}
if (!file_exists($tpl)) {
echo "404 Not Found";
exit;
}
$data_path = str_replace('/template', '/test', $tpl);
$data_path = str_replace('.tpl', '.php', $data_path);
require_once $root . 'libs/smarty/Smarty.class.php';
$smarty = new Smarty();
$default_conf = array('template_dir' => 'template', 'config_dir' => 'config', 'plugins_dir' => array('libs/Bigpipe/runtime/plugins'), 'left_delimiter' => '{%', 'right_delimiter' => '%}');
$smarty->setTemplateDir($root . $default_conf['template_dir']);
$smarty->setConfigDir($root . $default_conf['config_dir']);
foreach ($default_conf['plugins_dir'] as $dir) {
$smarty->addPluginsDir($root . $dir);
}
$smarty->setLeftDelimiter($default_conf['left_delimiter']);
$smarty->setRightDelimiter($default_conf['right_delimiter']);
if (file_exists($data_path)) {
require_once $data_path;
$smarty->assign($fis_data);
}
$smarty->display($tpl);
}
示例3: 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);
$leftDelimiter = $this->config('left_delimiter', '{');
$rightDelimiter = $this->config('right_delimiter', '}');
// 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;
$smarty->setLeftDelimiter($leftDelimiter);
$smarty->setRightDelimiter($rightDelimiter);
foreach ($__data as $var => $val) {
$smarty->assign($var, $val);
}
return $smarty->fetch($__path);
}
示例4: Smarty
<?php
/**
* 共有引用文件
* @author gaoqing
* 2015-09-04
*/
require_once './class/Smarty.class.php';
/*
* 1、实例化 Smarty 对象
* 2、设置其参数
*/
//1、实例化 Smarty 对象
$smarty = new Smarty();
//2、设置其参数
$smarty->setConfigDir("config.conf");
$smarty->setTemplateDir("tpl");
$smarty->setCompileDir("tpl_c");
$smarty->addPluginsDir("plugins");
$smarty->setLeftDelimiter("<{");
$smarty->setRightDelimiter("}>");
$smarty->setAutoLiteral(false);