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


PHP Zikula_View::tigger_error方法代码示例

本文整理汇总了PHP中Zikula_View::tigger_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Zikula_View::tigger_error方法的具体用法?PHP Zikula_View::tigger_error怎么用?PHP Zikula_View::tigger_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zikula_View的用法示例。


在下文中一共展示了Zikula_View::tigger_error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_block_case

/**
 * Zikula_View case block to implement switchs in a template.
 *
 * Available attributes:
 *  - expr (string|numeric) the value to be tested against the expr provided in
 *    the {@link smarty_block_switch() switch} tag.
 *
 * Example:
 * <pre>
 * {switch expr=$var}
 *   {case expr='1'}
 *     do some stuff for case $var == '1'
 *   {/case}
 *   {case expr='2'}
 *     do some stuff for case $var == '2'
 *   {/case}
 *   {case}
 *     default stuff
 *   {/case}
 * {/switch}
 * </pre>
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The content between the block tags.
 * @param Zikula_View $view    Reference to the {@link Zikula_View} object.
 * @param boolean     &$repeat Controls block repetition. See {@link http://www.smarty.net/manual/en/plugins.block.functions.php Smarty - Block Functions}.
 *
 * @see    smarty_block_switch
 *
 * @return void|string The content of the matching case.
 */
function smarty_block_case($params, $content, Zikula_View $view, &$repeat)
{
    if (is_null($content)) {
        // handle block open tag
        // find corresponding switch block
        for ($i = count($view->_tag_stack) - 1; $i >= 0; $i--) {
            list($tag_name, $tag_params) = $view->_tag_stack[$i];
            if ($tag_name == 'switch') {
                break;
            }
        }
        if ($i < 0) {
            // switch block not found
            $view->tigger_error(__('smarty_block_case: case not inside a switch block'));
            return;
        }
        if (isset($tag_params['_done']) && $tag_params['_done']) {
            // another case was already found
            $repeat = false;
            return;
        }
        // $tab_params['expr'] & $params['expr'] needs to be evaluated
        // For now - only worry about the expression passed by the case statement
        if (isset($params['expr']) && $params['expr'] != $tag_params['expr']) {
            // page doesn't match
            $repeat = false;
            return;
        }
        // page found
        $view->_tag_stack[$i][1]['_done'] = true;
        return;
    } else {
        // handle block close tag
        return $content;
    }
}
开发者ID:rmaiwald,项目名称:core,代码行数:67,代码来源:block.case.php


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