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


PHP XoopsTpl::template_exists方法代码示例

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


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

示例1: sprintf

 function xpress_block_render($mydirname, $block_function_name, $options)
 {
     global $wpdb, $xoops_config, $xoopsUserIsAdmin;
     $func_file = $block_function_name;
     $call_theme_function_name = str_replace(".php", "", $block_function_name);
     $inc_theme_file_name = $call_theme_function_name . '_theme.php';
     $cache_title = str_replace(".php", "", $block_function_name);
     $blockID = get_block_id($mydirname, $func_file, $options);
     $this_block_url = '/' . $mydirname . '/';
     $call_url = $_SERVER['REQUEST_URI'];
     $block['err_message'] = '';
     if (strstr($call_url, $this_block_url) !== false && strstr($call_url, $this_block_url . 'admin/') === false) {
         $block_theme_file = get_block_file_path($mydirname, $inc_theme_file_name);
         require_once $block_theme_file['file_path'];
         $block = $call_theme_function_name($options);
         //The block name and the called function name should be assumed to be the same name.
         if (!empty($block_theme_file['error'])) {
             $block['err_message'] .= $block_theme_file['error'];
         }
     } else {
         if (xpress_block_cache_found($mydirname, $cache_title . $blockID)) {
             $xml = xpress_block_cache_read($mydirname, $cache_title . $blockID);
             $block = $xml['block'];
         } else {
             $block['err_message'] .= sprintf(_MB_XP2_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname . '</a>');
         }
     }
     if (!cache_is_writable()) {
         $block['err_message'] = '<span style="color:#ff0000">';
         $block['err_message'] .= _MB_XP2_CACHE_NOT_WRITABLE;
         if ($xoopsUserIsAdmin) {
             $block['err_message'] .= " ({$cache_dir})";
             $block['err_message'] .= '</span>';
         }
     }
     xpress_block_header_set($mydirname);
     $block['request_uri'] = $_SERVER['REQUEST_URI'];
     $temp_option = @explode(':', $options[1]);
     if (isset($temp_option[1])) {
         $templates_file = $options[1];
     } else {
         $templates_file = 'db:' . $mydirname . '_' . str_replace(".php", ".html", $block_function_name);
     }
     $tpl = new XoopsTpl();
     $tpl->template_dir = $xoops_config->module_path . '/templates';
     if (!$tpl->template_exists($templates_file)) {
         $src_file_path = $xoops_config->module_path . '/templates/' . $mydirname . '_' . str_replace(".php", ".html", $block_function_name);
         $templates_file = add_xpress_tpl($mydirname, $templates_file, $src_file_path);
     }
     $tpl->assign('block', $block);
     $ret['content'] = $tpl->fetch($templates_file);
     if (preg_match('/\\S/', $ret['content'])) {
         return $ret;
     } else {
         return null;
     }
 }
开发者ID:nouphet,项目名称:rata,代码行数:57,代码来源:xpress_block_render.php


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