本文整理汇总了PHP中Smarty_Internal_Template类的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template类的具体用法?PHP Smarty_Internal_Template怎么用?PHP Smarty_Internal_Template使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Smarty_Internal_Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCache
/**
* Cache was invalid , so render from compiled and write to cache
*
* @param \Smarty_Template_Cached $cached
* @param \Smarty_Internal_Template $_template
* @param $no_output_filter
*
* @throws \Exception
*/
public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
{
ob_start();
if (!isset($_template->compiled)) {
$_template->loadCompiled();
}
$_template->compiled->render($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
$this->removeNoCacheHash($cached, $_template, $no_output_filter);
$compile_check = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
if (isset($_template->parent) && $_template->parent->_objType == 2) {
$_template->compiled->unifunc = $_template->parent->compiled->unifunc;
}
if (!$_template->cached->processed) {
$_template->cached->process($_template, true);
}
$_template->smarty->compile_check = $compile_check;
$cached->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
}
示例2: smarty_function_liveCustomization
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_liveCustomization($params, Smarty_Internal_Template $smarty)
{
$app = $smarty->getApplication();
if ($app->isCustomizationMode()) {
// theme dropdown
$themes = array_merge(array('barebone' => 'barebone'), array_diff($app->getRenderer()->getThemeList(), array('barebone')));
$smarty->assign('themes', $themes);
$smarty->assign('currentTheme', $app->getTheme());
if (!isset($params['action'])) {
include_once 'function.includeJs.php';
include_once 'function.includeCss.php';
smarty_function_includeJs(array('file' => "library/prototype/prototype.js"), $smarty);
smarty_function_includeJs(array('file' => "library/livecart.js"), $smarty);
smarty_function_includeJs(array('file' => "library/form/ActiveForm.js"), $smarty);
smarty_function_includeJs(array('file' => "library/form/Validator.js"), $smarty);
smarty_function_includeJs(array('file' => "backend/Backend.js"), $smarty);
smarty_function_includeJs(array('file' => "frontend/Customize.js"), $smarty);
smarty_function_includeCss(array('file' => "frontend/LiveCustomization.css"), $smarty);
} else {
$smarty->assign('mode', $app->getCustomizationModeType());
$smarty->assign('theme', $app->getTheme());
if ('menu' == $params['action']) {
return $smarty->fetch('customize/menu.tpl');
} else {
if ('lang' == $params['action']) {
return $smarty->fetch('customize/translate.tpl');
}
}
}
}
}
示例3: smarty_block_tip
/**
* Display a tip block
*
* @package application.helper.smarty
* @author Integry Systems
*
* @package application.helper.smarty
*/
function smarty_block_tip($params, $content, Smarty_Internal_Template $smarty, &$repeat)
{
if (!$repeat) {
$smarty->assign('tipContent', $content);
return $smarty->display('block/backend/tip.tpl');
}
}
示例4: load
/**
* get a Compiled Object of this source
* @param Smarty_Internal_Template $_template template object
* @return Smarty_Template_Compiled compiled object
*/
static function load($_template)
{
if (!isset($_template->source)) {
$_template->loadSource();
}
// check runtime cache
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
$_cache_key = $_template->source->unique_resource . '#';
if ($_template->caching) {
$_cache_key .= 'caching#';
}
$_cache_key .= $_template->compile_id;
if (isset($_template->source->compileds[$_cache_key])) {
return $_template->source->compileds[$_cache_key];
}
}
$compiled = new Smarty_Template_Compiled();
if (method_exists($_template->source->handler, 'populateCompiledFilepath')) {
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
} else {
$compiled->populateCompiledFilepath($_template);
}
// runtime cache
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
$_template->source->compileds[$_cache_key] = $compiled;
}
return $compiled;
}
示例5: smarty_function_getdatatablerow
/**
* PixelManager CMS (Community Edition)
* Copyright (C) 2016 PixelProduction (http://www.pixelproduction.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function smarty_function_getdatatablerow($params, Smarty_Internal_Template $template)
{
if (!isset($params['class']) || !isset($params['var']) || !isset($params['row'])) {
return;
}
if (isset($params['page'])) {
$page_id = $params['page'];
} else {
$page_id = $template->getTemplateVars('pageId');
}
if (isset($params['language'])) {
$language_id = $params['language'];
} else {
$language_id = $template->getTemplateVars('languageId');
if ($language_id === null) {
$language_id = Config::get()->languages->standard;
}
}
$data = array();
if (isset($params['row'])) {
$data_table = new $params['class']();
$data = $data_table->getRowForFrontend($params['row'], $page_id, $language_id);
}
if (isset($params['var'])) {
$template->assign($params['var'], $data);
}
}
示例6: process
/**
* compile template from source
*
* @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
*
* @throws Exception
*/
public function process(Smarty_Internal_Template $_smarty_tpl)
{
$compiled =& $_smarty_tpl->compiled;
$compiled->file_dependency = array();
$compiled->includes = array();
$compiled->nocache_hash = null;
$compiled->unifunc = null;
$level = ob_get_level();
ob_start();
$_smarty_tpl->loadCompiler();
// call compiler
try {
eval("?>" . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl));
} catch (Exception $e) {
unset($_smarty_tpl->compiler);
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
// release compiler object to free memory
unset($_smarty_tpl->compiler);
ob_get_clean();
$compiled->timestamp = time();
$compiled->exists = true;
}
示例7: smarty_function_manufacturerUrl
/**
* Generates manufacturer page URL
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_manufacturerUrl($params, Smarty_Internal_Template $smarty)
{
$manufacturer = $params['data'];
$params['data'] =& Category::getRootNode()->toArray();
$params['addFilter'] = new ManufacturerFilter($manufacturer['ID'], $manufacturer['name']);
return createCategoryUrl($params, $smarty->getApplication());
}
示例8: smarty_function_pageurl
function smarty_function_pageurl($params, Smarty_Internal_Template $template)
{
$output = '';
if (isset($params['page'])) {
if (isset($params['language'])) {
$language_id = $params['language'];
} else {
$language_id = $template->getTemplateVars('languageId');
if ($language_id === null) {
$language_id = Config::get()->languages->standard;
}
}
$mixed_id = $params['page'];
$page_id = false;
$pages = new Pages();
if (is_int($mixed_id)) {
$page_id = $mixed_id;
} else {
if (is_numeric($mixed_id)) {
$page_id = (int) $mixed_id;
} else {
if (is_string($mixed_id)) {
$page_id = $pages->getPageIdByUniqueId($mixed_id);
}
}
}
if ($page_id !== false) {
$output = $pages->getPageUrl($page_id, $language_id);
}
}
return $output;
}
示例9: smarty_block_begin_widget
/**
* Allows to use Yii beginWidget() and endWidget() methods in a simple way.
* There is a variable inside a block wich has 'widget' name and represent widget object
*
* Example:
* {begin_widget name="activeForm" foo="" bar="" otherParam="" [...]}
* {$widget->some_method_or_variable}
* {/begin_widget}
*
* @param array $params parameters
* @param string $content contents of the block
* @param Smarty_Internal_Template $template template object
* @param boolean &$repeat repeat flag
* @return string
* @author t.yacenko (thekip)
*/
function smarty_block_begin_widget($params, $content, $template, &$repeat)
{
$controller_object = $template->tpl_vars['this']->value;
if ($controller_object == null) {
throw new CException("Can't get controller object from template. Error.");
}
if ($repeat) {
//tag opened
if (!isset($params['name'])) {
throw new CException("Name parameter should be specified.");
}
$widgetName = $params['name'];
unset($params['name']);
//some widgets has 'name' as property. You can pass it by '_name' parameter
if (isset($params['_name'])) {
$params['name'] = $params['_name'];
unset($params['_name']);
}
$template->assign('widget', $controller_object->beginWidget($widgetName, $params, false));
} else {
//tag closed
echo $content;
$controller_object->endWidget();
$template->clearAssign('widget');
}
}
示例10: theliaModule
/**
* Process theliaModule template inclusion function
*
* This function accepts two parameters:
*
* - location : this is the location in the admin template. Example: folder-edit'. The function will search for
* AdminIncludes/<location>.html file, and fetch it as a Smarty template.
* - countvar : this is the name of a template variable where the number of found modules includes will be assigned.
*
* @param array $params
* @param \Smarty_Internal_Template $template
* @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty
*
* @return string
*/
public function theliaModule($params, \Smarty_Internal_Template $template)
{
$content = null;
$count = 0;
if (false !== ($location = $this->getParam($params, 'location', false))) {
if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) {
echo sprintf('<div style="background-color: #C82D26; color: #fff; border-color: #000000; border: solid;">%s</div>', $location);
}
$moduleLimit = $this->getParam($params, 'module', null);
$modules = ModuleQuery::getActivated();
/** @var \Thelia\Model\Module $module */
foreach ($modules as $module) {
if (null !== $moduleLimit && $moduleLimit != $module->getCode()) {
continue;
}
$file = $module->getAbsoluteAdminIncludesPath() . DS . $location . '.html';
if (file_exists($file)) {
$output = trim(file_get_contents($file));
if (!empty($output)) {
$content .= $output;
$count++;
}
}
}
}
if (false !== ($countvarname = $this->getParam($params, 'countvar', false))) {
$template->assign($countvarname, $count);
}
if (!empty($content)) {
return $template->fetch(sprintf("string:%s", $content));
}
return "";
}
示例11: smarty_block_menuItem
/**
* Smarty block plugin, for generating page menu item
* This block must always be called in pageMenu block context
*
* @param array $params
* @param Smarty $smarty
* @param $repeat
*
* <code>
* {pageMenu id="menu"}
* {menuItem}
* {menuCaption}Click Me{/menuCaption}
* {menuAction}http://click.me.com{/menuAction}
* {/menuItem}
* {menuItem}
* {menuCaption}Another menu item{/menuCaption}
* {pageAction}alert('Somebody clicked on me too!'){/menuAction}
* {/menuItem}
* {/pageMenu}
* </code>
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_block_menuItem($params, $content, Smarty_Internal_Template $smarty, &$repeat)
{
if ($repeat) {
$smarty->clear_assign('menuCaption');
$smarty->clear_assign('menuAction');
$smarty->clear_assign('menuPageAction');
} else {
$item = new HtmlElement('a');
if ($smarty->getTemplateVars('menuAction')) {
$href = $smarty->getTemplateVars('menuAction');
} else {
if ($smarty->getTemplateVars('menuPageAction')) {
$onClick = $smarty->getTemplateVars('menuPageAction');
$href = '#';
$item->setAttribute('onClick', $onClick . '; return false;');
}
}
$item->setAttribute('href', $href);
// EXPERIMENTAL - set access key for menu item
$caption = $smarty->getTemplateVars('menuCaption');
if (FALSE != strpos($caption, '&&')) {
$p = strpos($caption, '&&');
$accessKey = substr($caption, $p + 2, 1);
$item->setAttribute('accessKey', $accessKey);
$caption = substr($caption, 0, $p + 3) . '</span>' . substr($caption, $p + 3);
$caption = substr($caption, 0, $p) . '<span class="accessKey">' . substr($caption, $p + 2);
}
$item->setContent($caption);
$smarty->append('pageMenuItems', $item->render());
}
}
示例12: smarty_function_generate_id
/**
* 生成当前请求唯一的ID,并赋值给制定的模板变量名,依赖与全局模板变量__unique__
* 当__unique__存在的时候,生成的ID值会自动缀上这个数值,用于生成不同请求间的唯一ID
* 一般用于页面整体内容作为ajax响应结果写入页面,而这个页面又需要引入有ID的widget这种情况
* @param String $params.assign 生成的参数赋值给的模板变量名,默认赋值给WIDGET_ID
* @param Smarty_Internal_Template $template
*/
function smarty_function_generate_id($params, Smarty_Internal_Template $template)
{
$assign = !empty($params['assign']) ? $params['assign'] : "WIDGET_ID";
static $id = 0;
$id++;
$template->assign($assign, $id . $template->tpl_vars["__unique__"]);
}
示例13: smarty_function_widget_template
/**
* Plugin for Smarty
*
* @param array $aParams
* @param Smarty_Internal_Template $oSmartyTemplate
*
* @return string|null
*/
function smarty_function_widget_template($aParams, $oSmartyTemplate)
{
if (!isset($aParams['name'])) {
trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING);
return null;
}
$sWidgetName = $aParams['name'];
$aWidgetParams = isset($aParams['params']) ? $aParams['params'] : array();
$oEngine = Engine::getInstance();
// Проверяем делигирование
$sTemplate = E::ModulePlugin()->GetDelegate('template', $sWidgetName);
if ($sTemplate) {
if ($aWidgetParams) {
foreach ($aWidgetParams as $sKey => $sVal) {
$oSmartyTemplate->assign($sKey, $sVal);
}
if (!isset($aWidgetParams['params'])) {
/* LS-compatible */
$oSmartyTemplate->assign('params', $aWidgetParams);
}
$oSmartyTemplate->assign('aWidgetParams', $aWidgetParams);
}
$sResult = $oSmartyTemplate->fetch($sTemplate);
} else {
$sResult = null;
}
return $sResult;
}
示例14: smarty_function_metricsfield
/**
*
* @package application.helper.smarty.form
* @author Integry Systems
*/
function smarty_function_metricsfield($params, Smarty_Internal_Template $smarty)
{
if (empty($params['name'])) {
$params['name'] = $smarty->getTemplateVars('input_name');
}
$formParams = $smarty->_tag_stack[0][1];
$formHandler = $formParams['handle'];
if (!isset($params['value']) && !$formHandler instanceof Form) {
throw new HelperException('Element must be placed in {form} block');
}
if (!empty($formParams['model'])) {
$params['ng-model'] = $formParams['model'] . '.' . $params['name'];
}
$application = $smarty->getApplication();
$params['m_sw'] = $application->translate('_switch_to_english_units');
$params['en_sw'] = $application->translate('_switch_to_metric_units');
$params['m_hi'] = $application->translate('_units_kg');
$params['m_lo'] = $application->translate('_units_g');
$params['en_hi'] = $application->translate('_units_lbs');
$params['en_lo'] = $application->translate('_units_oz');
$params['type'] = strtolower($application->getConfig()->get('UNIT_SYSTEM'));
$content = '<weight-input ' . $smarty->appendParams($content, $params) . '></weight-input>';
$content = $smarty->formatControl($content, $params);
return $content;
}
示例15: content_56ee2ea61703d4_35460691
function content_56ee2ea61703d4_35460691(Smarty_Internal_Template $_smarty_tpl)
{
?>
<section class="content-header">
<h1>
Data Jabatan
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-database"></i> Master</a></li>
<li><a href="#">Jabatan</a></li>
<li class="active">Tambah Data</li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<!-- notification template -->
<?php
$_smarty_tpl->_subTemplateRender("file:base/templates/notification.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>
<!-- end of notification template-->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Tambah Data jabatan</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form action="<?php
echo $_smarty_tpl->tpl_vars['config']->value->site_url('master/jabatan/add_process');
?>
" method="post" class="form-horizontal">
<div class="box-body">
<div class="form-group">
<label for="nama_jabatan" class="col-sm-2 control-label">Nama jabatan</label>
<div class="col-sm-5">
<input type="text" name="nama_jabatan" class="form-control" id="nama_jabatan" placeholder="nama jabatan" value="<?php
echo ($tmp = @$_smarty_tpl->tpl_vars['result']->value['nama_jabatan']) === null || $tmp === '' ? '' : $tmp;
?>
">
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<a class="btn btn-default" href="<?php
echo $_smarty_tpl->tpl_vars['config']->value->site_url('master/jabatan/');
?>
"><i class="fa fa-long-arrow-left"></i> Batal</a>
<button type="submit" class="btn btn-info pull-right">Simpan</button>
</div>
<!-- /.box-footer -->
</form>
</div>
</div>
</div>
</section>
<?php
}
开发者ID:yanlyan,项目名称:si_ibuhamil,代码行数:60,代码来源:ac3160c0e1afd52650da2fb88029d7d1ffd02802_0.file.add.html.php