当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Template::getSubTemplate方法代码示例

本文整理汇总了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);
            }
        }
    }
}
开发者ID:drehere,项目名称:shenmegui,代码行数:27,代码来源:block.fis_widget.php

示例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);
 }
开发者ID:imnotjames,项目名称:smartyview,代码行数:33,代码来源:Laravel.php

示例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);
}
开发者ID:laiello,项目名称:phpbf,代码行数:27,代码来源:function.header.php

示例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);
}
开发者ID:laiello,项目名称:phpbf,代码行数:11,代码来源:function.footer.php

示例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);
    }
}
开发者ID:drehere,项目名称:shenmegui,代码行数:19,代码来源:block.fis_widget_inline.php


注:本文中的Smarty_Internal_Template::getSubTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。