本文整理汇总了PHP中template_compile函数的典型用法代码示例。如果您正苦于以下问题:PHP template_compile函数的具体用法?PHP template_compile怎么用?PHP template_compile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_compile函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
function template($filename, $flag = TEMPLATE_DISPLAY)
{
global $_W;
$source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = IA_ROOT . "/web/themes/default/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php";
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile);
}
switch ($flag) {
case TEMPLATE_DISPLAY:
default:
extract($GLOBALS, EXTR_SKIP);
include $compile;
break;
case TEMPLATE_FETCH:
extract($GLOBALS, EXTR_SKIP);
ob_clean();
ob_start();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
break;
case TEMPLATE_INCLUDEPATH:
return $compile;
break;
}
}
示例2: template
public function template($filename, $flag = TEMPLATE_INCLUDEPATH)
{
global $_W, $_GPC;
$_W['template'] = $_W['account']['template'];
$_W['template']['source'] = $_W['account']['template'];
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_W['template']}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$_W['template']}/{$this->mn}/{$filename}.tpl.php";
if (!empty($_GPC['__template'])) {
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_GPC['__template']}/{$filename}.html";
if (!is_file($source)) {
die('invalid debug template ' . $_GPC['__template']);
}
}
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$this->mn}/template/mobile/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$this->mn}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$filename}.html";
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
}
}
}
}
WeUtility::logging('compile source', array($source, $compile));
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例3: template
function template($filename, $flag = TEMPLATE_DISPLAY)
{
global $_W;
$paths = explode('/', $filename);
if (defined('IN_MOBILE')) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/" . implode('/', $paths) . ".html";
$compile = "{$_W['template']['compile']}/mobile/{$_W['account']['template']}/" . implode('/', $paths) . ".tpl.php";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/" . implode('/', $paths) . ".html";
$compile = "{$_W['template']['compile']}/mobile/default/" . implode('/', $paths) . ".tpl.php";
}
} else {
$source = "{$_W['template']['source']}/web/{$_W['template']['current']}/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/{$_W['template']['current']}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/web/default/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/default/{$filename}.tpl.php";
}
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile);
}
switch ($flag) {
case TEMPLATE_DISPLAY:
default:
extract($GLOBALS, EXTR_SKIP);
include $compile;
break;
case TEMPLATE_FETCH:
extract($GLOBALS, EXTR_SKIP);
ob_start();
ob_clean();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
break;
case TEMPLATE_INCLUDEPATH:
return $compile;
break;
case TEMPLATE_CACHE:
exit('暂未支持');
break;
}
}
示例4: template
function template($filename, $flag = TEMPLATE_DISPLAY)
{
global $_W, $_GPC;
$source = IA_ROOT . "/app/themes/{$_W['template']}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$_W['template']}/{$filename}.tpl.php";
if (!is_file($source)) {
$compatFilename = template_compat($filename);
if (!empty($compatFilename)) {
return template($compatFilename, $flag);
}
}
if (!is_file($source)) {
$source = IA_ROOT . "/app/themes/default/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/default/{$filename}.tpl.php";
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
$paths = pathinfo($compile);
$compile = str_replace($paths['filename'], $_W['uniacid'] . '_' . intval($_GPC['t']) . '_' . $paths['filename'], $compile);
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile);
}
switch ($flag) {
case TEMPLATE_DISPLAY:
default:
extract($GLOBALS, EXTR_SKIP);
include $compile;
break;
case TEMPLATE_FETCH:
extract($GLOBALS, EXTR_SKIP);
ob_clean();
ob_start();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
break;
case TEMPLATE_INCLUDEPATH:
return $compile;
break;
}
}
示例5: template
protected function template($filename)
{
global $_W;
$name = strtolower($this->module->id);
$basePath = \Yii::getAlias($this->module->model->path);
$baseCompiledPath = \Yii::getAlias($this->module->templateCompiledPath . '/' . $this->module->id);
if (IN_SYS) {
$source = $basePath . "/template/{$filename}.html";
$compile = $baseCompiledPath . "/{$filename}.tpl.php";
} else {
$source = $basePath . "/template/mobile/{$filename}.html";
$compile = $baseCompiledPath . "/mobile/{$filename}.tpl.php";
}
$paths = pathinfo($compile);
$compile = str_replace($paths['filename'], $_W['uniacid'] . '_' . $paths['filename'], $compile);
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
if (!is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例6: template
function template($template = 'index', $dir = '')
{
global $CFG;
$to = $dir ? DT_CACHE . '/tpl/' . $dir . '-' . $template . '.php' : DT_CACHE . '/tpl/' . $template . '.php';
$isfileto = is_file($to);
if ($CFG['template_refresh'] || !$isfileto) {
if ($dir) {
$dir = $dir . '/';
}
$from = DT_ROOT . '/template/' . $CFG['template'] . '/' . $dir . $template . '.htm';
if ($CFG['template'] != 'default' && !is_file($from)) {
$from = DT_ROOT . '/template/default/' . $dir . $template . '.htm';
}
if (!$isfileto || filemtime($from) > filemtime($to) || filesize($to) == 0 && filesize($from) > 0) {
require_once DT_ROOT . '/include/template.func.php';
template_compile($from, $to);
}
}
return $to;
}
示例7: template
protected function template($filename)
{
global $_W;
$name = strtolower($this->modulename);
$defineDir = dirname($this->__define);
if (defined('IN_SYS')) {
$source = IA_ROOT . "/web/themes/{$_W['template']}/{$name}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$name}/{$filename}.tpl.php";
if (!empty($defineDir)) {
$source = $defineDir . "/template/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/web/addons/{$name}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = IA_ROOT . "/web/themes/default/{$name}/{$filename}.html";
}
if (!is_file($source)) {
$source = $defineDir . "/template/{$filename}.html";
}
if (!is_file($source)) {
$source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
}
if (!is_file($source)) {
$source = IA_ROOT . "/web/themes/default/{$filename}.html";
}
} else {
$source = IA_ROOT . "/app/themes/{$_W['template']}/{$name}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$_W['template']}/{$name}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = IA_ROOT . "/app/themes/default/{$name}/{$filename}.html";
}
if (!is_file($source)) {
$source = $defineDir . "/template/mobile/{$filename}.html";
}
if (!is_file($source)) {
$source = IA_ROOT . "/app/themes/{$_W['template']}/{$filename}.html";
}
if (!is_file($source)) {
if (in_array($filename, array('header', 'footer', 'slide', 'toolbar', 'message'))) {
$source = IA_ROOT . "/app/themes/default/common/{$filename}.html";
} else {
$source = IA_ROOT . "/app/themes/default/{$filename}.html";
}
}
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例8: template
protected function template($filename)
{
global $_W;
$name = strtolower($this->modulename);
$defineDir = dirname($this->__define);
if (defined('IN_SYS')) {
return parent::template($filename);
} else {
$source = THEME_DIR . "{$_W['account']['template']}/{$filename}.html";
$compile = THEME_COMPILE_DIR . "{$name}/{$_W['account']['template']}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = DEFAULT_THEME_DIR . "{$filename}.html";
}
if (!is_file($source)) {
if (in_array($filename, array('header', 'footer', 'slide', 'toolbar', 'message'))) {
$source = IA_ROOT . "/app/themes/default/common/{$filename}.html";
} else {
$source = IA_ROOT . "/app/themes/default/{$filename}.html";
}
}
}
if (!is_file($source)) {
exit("Error: template source {$source} - filename '{$filename}' - name {$name} is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例9: template
public function template($_var_14, $_var_15 = TEMPLATE_INCLUDEPATH)
{
global $_W;
$_var_16 = strtolower($this->modulename);
if (defined('IN_SYS')) {
$_var_17 = IA_ROOT . "/web/themes/{$_W['template']}/{$_var_16}/{$_var_14}.html";
$_var_18 = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$_var_16}/{$_var_14}.tpl.php";
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/web/themes/default/{$_var_16}/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/addons/{$_var_16}/template/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/web/themes/{$_W['template']}/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/web/themes/default/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_19 = explode('/', $_var_14);
$_var_20 = array_slice($_var_19, 1);
$_var_17 = IA_ROOT . "/addons/{$_var_16}/plugin/" . $_var_19[0] . '/template/' . implode('/', $_var_20) . '.html';
}
} else {
$_var_21 = 'default';
$_var_13 = IA_ROOT . '/addons/ewei_shop/data/template/shop_' . $_W['uniacid'];
if (is_file($_var_13)) {
$_var_21 = file_get_contents($_var_13);
if (!is_dir(IA_ROOT . '/addons/ewei_shop/template/mobile/' . $_var_21)) {
$_var_21 = 'default';
}
}
$_var_18 = IA_ROOT . "/data/tpl/app/ewei_shop/{$_var_21}/mobile/{$_var_14}.tpl.php";
$_var_17 = IA_ROOT . "/addons/{$_var_16}/template/mobile/{$_var_21}/{$_var_14}.html";
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/addons/{$_var_16}/template/mobile/default/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/app/themes/{$_W['template']}/{$_var_14}.html";
}
if (!is_file($_var_17)) {
$_var_17 = IA_ROOT . "/app/themes/default/{$_var_14}.html";
}
}
if (!is_file($_var_17)) {
die("Error: template source '{$_var_14}' is not exist!");
}
if (DEVELOPMENT || !is_file($_var_18) || filemtime($_var_17) > filemtime($_var_18)) {
template_compile($_var_17, $_var_18, true);
}
return $_var_18;
}
示例10: template
protected function template($filename, $flag = TEMPLATE_INCLUDEPATH)
{
global $_W;
$mn = strtolower($this->module['name']);
if ($this->inMobile) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/{$mn}/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/{$_W['account']['template']}/{$mn}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$mn}/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/default/{$mn}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = IA_ROOT . "/source/modules/{$mn}/template/mobile/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/modules/{$mn}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/{$_W['account']['template']}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/default/{$filename}.tpl.php";
}
} else {
$source = "{$_W['template']['source']}/web/{$_W['account']['template']}/modules/{$mn}/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/{$_W['account']['template']}/modules/{$mn}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/web/default/modules/{$mn}/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/default/modules/{$mn}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = IA_ROOT . "/source/modules/{$mn}/template/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/{$_W['account']['template']}/modules/{$mn}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = "{$_W['template']['source']}/web/{$_W['account']['template']}/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/{$_W['account']['template']}/{$filename}.tpl.php";
}
if (!is_file($source)) {
$source = "{$_W['template']['source']}/web/default/{$filename}.html";
$compile = "{$_W['template']['compile']}/web/default/{$filename}.tpl.php";
}
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例11: template
protected function template($filename, $flag = TEMPLATE_INCLUDEPATH)
{
global $_W, $_GPC;
$mn = strtolower($this->module['name']);
$template = empty($this->module['config']['template']) ? "default" : $this->module['config']['template'];
if (!empty($_GPC['template'])) {
$template = trim($_GPC['template']);
}
if ($this->inMobile) {
$source = IA_ROOT . "/source/modules/{$mn}/template/mobile/{$template}/{$filename}.html";
$compile = "{$_W['template']['compile']}/mobile/modules/{$mn}/{$template}/{$filename}.tpl.php";
if (!is_file($source)) {
exit("Error222: template source '{$filename}' is not exist!");
}
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
} else {
return parent::template($filename);
}
}
示例12: template
public function template($filename, $flag = TEMPLATE_INCLUDEPATH) {
global $_W;
list($path, $filename) = explode('/', $filename);
$source = IA_ROOT . "/source/modules/$path/template/{$filename}.html";
if(!is_file($source)) {
$source = "{$_W['template']['source']}/{$_W['template']['current']}/{$filename}.html";
}
if(!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
$compile = "{$_W['template']['compile']}/{$_W['template']['current']}/{$path}/{$filename}.tpl.php";
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile);
}
switch ($flag) {
case TEMPLATE_DISPLAY:
default:
extract($GLOBALS, EXTR_SKIP);
include $compile;
break;
case TEMPLATE_FETCH:
extract($GLOBALS, EXTR_SKIP);
ob_start();
ob_clean();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
break;
case TEMPLATE_INCLUDEPATH:
return $compile;
break;
case TEMPLATE_CACHE:
exit('暂未支持');
break;
}
}