本文整理匯總了PHP中Smarty_Internal_Template::getSubTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Template::getSubTemplate方法的具體用法?PHP Smarty_Internal_Template::getSubTemplate怎麽用?PHP Smarty_Internal_Template::getSubTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::getSubTemplate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: smarty_block_fis_widget
function smarty_block_fis_widget($params, $content, Smarty_Internal_Template $template, &$repeat)
{
if (!$repeat) {
if (isset($params['extends'])) {
$path = $params['extends'];
unset($params['extends']);
foreach ($params as $key => $v) {
if ($template->getTemplateVars($key)) {
$params[$key] = $template->getTemplateVars($key);
}
}
return $content = $template->getSubTemplate($path, $template->cache_id, $template->compile_id, null, null, $params, Smarty::SCOPE_LOCAL);
} else {
return $content;
}
} else {
if (isset($params['extends'])) {
unset($params['extends']);
}
foreach ($params as $key => $v) {
$value = $template->getTemplateVars($key);
if ($value === null) {
$template->assign($key, $v, true);
}
}
}
}
示例2: getSubTemplate
public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)
{
// get variables from calling scope
if ($parent_scope == \Smarty::SCOPE_LOCAL) {
$newData = $this->tpl_vars;
$newData['smarty'] = clone $this->tpl_vars['smarty'];
} elseif ($parent_scope == \Smarty::SCOPE_PARENT) {
$newData =& $this->tpl_vars;
} elseif ($parent_scope == \Smarty::SCOPE_GLOBAL) {
$newData =& \Smarty::$global_tpl_vars;
} elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {
$newData =& $this->tpl_vars;
} else {
$newData =& $scope_ptr->tpl_vars;
}
if (!empty($data)) {
// set up variable values
foreach ($data as $_key => $_val) {
$newData[$_key] = new \Smarty_variable($_val);
}
}
$extension = '.' . \Config::get('smartyview::extension', 'tpl');
if (substr_compare($template, $extension, -strlen($extension), strlen($extension)) !== 0) {
try {
return \View::make($template, array_map(function ($v) {
return $v->value;
}, $newData));
} catch (\Exception $e) {
}
}
// Fall back to parent's getSubTemplate..
return parent::getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope);
}
示例3: smarty_function_header
function smarty_function_header($p, Smarty_Internal_Template $template)
{
$tpl = $template->smarty;
if (isset($p['title'])) {
$tpl->data['title'] = $p['title'];
}
if (isset($p['keywords'])) {
$tpl->data['keywords'] = $p['keywords'];
}
if (isset($p['description'])) {
$tpl->data['description'] = $p['description'];
}
if (isset($p['creator'])) {
$tpl->data['creator'] = $p['creator'];
}
if (isset($p['subject'])) {
$tpl->data['subject'] = $p['subject'];
}
$vars = array();
foreach ($p as $key => $val) {
if ($key == 'title' || $key == 'file' || $key == 'keywords' || $key == 'description' || $key == 'creator' || $key == 'subject') {
continue;
}
$vars[$key] = $val;
}
return $template->getSubTemplate(isset($p['file']) ? $p['file'] : "header.tpl", $template->cache_id, $template->compile_id, null, null, $vars, 0);
}
示例4: smarty_function_footer
function smarty_function_footer($p, Smarty_Internal_Template $template)
{
$vars = array();
foreach ($p as $key => $val) {
if ($key == 'file') {
continue;
}
$vars[$key] = $val;
}
return $template->getSubTemplate(isset($p['file']) ? $p['file'] : "footer.tpl", $template->cache_id, $template->compile_id, null, null, $vars, 0);
}
示例5: smarty_block_fis_widget_inline
function smarty_block_fis_widget_inline($params, $content, Smarty_Internal_Template $template, &$repeat)
{
if (!$repeat) {
//block 定義結束
if (isset($params['extends'])) {
$path = $params['extends'];
unset($params['extends']);
$content = $template->getSubTemplate($path, $template->cache_id, $template->compile_id, null, null, $params, Smarty::SCOPE_LOCAL);
}
FISBlockFisWidget::pop($template->tpl_vars);
return $content;
} else {
//block 定義開始
if (isset($params['extends'])) {
unset($params['extends']);
}
FISBlockFisWidget::push($params, $template->tpl_vars);
}
}