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


PHP tpl::trigger_error方法代码示例

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


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

示例1: tpl_function_include_clipcache

/**
 * tpl {include_clipcache} function plugin
 *
 * Includes a template using private caching parameters. Must be registered as non-caching.
 *
 * @file        function.include_clipcache.php
 * @version     0.1.7 2006-May-11
 * @since       2005-APR-08
 *
 * @author      boots {jayboots ~ yahoo com}
 * @copyright   brainpower, boots, 2004-2006
 * @license     LGPL 2.1
 * @link        http://www.phpinsider.com/tpl-forum/viewtopic.php?p=19733#19733
 *
 * @param array $params
 * @param tpl $tpl
 *
 * This function observes the following tag attributes (in $params):
 *
 * #param file required template file
 * #param cache_id required specify cache build group
 * #param cache_lifetime required time to live for template part/group
 * #param ldelim optional specify the left delimiter to use for included content
 * #param rdelim optional specify the right delimiter to use for included content
 */
function tpl_function_include_clipcache($params, &$tpl)
{
    // validation
    foreach (array('cache_id', 'file', 'cache_lifetime') as $required) {
        if (!array_key_exists($required, $params)) {
            $tpl->trigger_error("include_clipcache: '{$required}' param missing. Aborted.", E_USER_WARNING);
            return;
        }
    }
    // handle optional delimiters
    foreach (array('rdelim' => $tpl->right_delimiter, 'ldelim' => $tpl->left_delimiter) as $optional => $default) {
        ${"_{$optional}"} = $default;
        ${$optional} = array_key_exists($optional, $params) ? $params[$optional] : $default;
    }
    $tpl->compile_check = false;
    // save tpl environment as proposed by calling template
    $_caching = $tpl->cache;
    if (caching == 1) {
        $tpl->cache = 2;
    }
    $_cache_lifetime = $tpl->cache_lifetime;
    $tpl->cache_lifetime = $params['cache_lifetime'];
    $tpl->left_delimiter = $ldelim;
    $tpl->right_delimiter = $rdelim;
    // run the requested clipcache template
    $content = $tpl->fetch($params['file'], $params['cache_id']);
    // restore tpl environment as proposed by calling template
    $tpl->cache = $_caching;
    $tpl->cache_lifetime = $_cache_lifetime;
    $tpl->left_delimiter = $_ldelim;
    $tpl->right_delimiter = $_rdelim;
    return $content;
}
开发者ID:holsinger,项目名称:openfloor,代码行数:58,代码来源:function.include_clipcache.php


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