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


PHP XoopsTpl::clear_assign方法代码示例

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


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

示例1: list


//.........这里部分代码省略.........
             $arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous"));
         }
     }
     $ret = "";
     if ($tgt == "?") {
         foreach ($arr as $myblock) {
             $block = array();
             $block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type");
             $name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name");
             $bid = $myblock->getVar('bid');
             $ret .= "<li>(" . $bid . ")" . $name . "</li>";
         }
     } else {
         global $xoopsTpl;
         require_once XOOPS_ROOT_PATH . '/class/template.php';
         $xoopsTpl = new XoopsTpl();
         if (is_object($xoopsUser)) {
             $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin()));
         }
         $xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES));
         foreach ($tgt_bids as $bid) {
             $myblock = new XoopsBlock($bid);
             $_bid = $myblock->getVar('bid');
             if (!empty($_bid)) {
                 $bcachetime = $myblock->getVar('bcachetime');
                 // Only a guest enable cache. by nao-pon
                 //if (empty($bcachetime)) {
                 if ($bcachetime % 10 == 1) {
                     $bcachetime_guest = TRUE;
                     $bcachetime = $bcachetime - 1;
                 } else {
                     $bcachetime_guest = FALSE;
                 }
                 if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) {
                     //if (empty($bcachetime)) {
                     $xoopsTpl->xoops_setCaching(0);
                 } else {
                     $xoopsTpl->xoops_setCaching(2);
                     $xoopsTpl->xoops_setCacheTime($bcachetime);
                 }
                 $btpl = $myblock->getVar('template');
                 if ($btpl != '') {
                     if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $myblock->getVar('bid'))) {
                         //$xoopsLogger->addBlock($myblock->getVar('name'));
                         $bresult = $myblock->buildBlock();
                         if (!$bresult) {
                             continue;
                         }
                         $xoopsTpl->assign_by_ref('block', $bresult);
                         $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid'));
                         $xoopsTpl->clear_assign('block');
                     } else {
                         //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime);
                         $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid'));
                     }
                 } else {
                     //$bid = $myblock->getVar('bid');
                     if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
                         //$xoopsLogger->addBlock($myblock->getVar('name'));
                         $bresult = $myblock->buildBlock();
                         if (!$bresult) {
                             continue;
                         }
                         $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
                         $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
                         $xoopsTpl->clear_assign('block');
                     } else {
                         //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime);
                         $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
                     }
                 }
                 $btitle = $myblock->getVar('title');
             } else {
                 $btitle = "Block({$bid})";
                 $bcontent = "Block({$bid}) is not found.";
             }
             if ($bcontent) {
                 $ret .= "<h5>" . $btitle . "</h5>\n";
                 $ret .= $bcontent;
                 foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_block_header')) as $str) {
                     $this->root->head_tags[] = rtrim($str);
                 }
                 foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_module_header')) as $str) {
                     $this->root->head_tags[] = rtrim($str);
                 }
                 $this->root->head_tags = array_unique($this->root->head_tags);
             }
         }
         unset($myblock);
     }
     if (!$css_show) {
         $css_show = true;
         $this->root->head_pre_tags[] = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . XOOPS_URL . "/xoops.css\" />";
     }
     if ($tgt == "?") {
         $ret = "<ul>{$ret}</ul>";
     }
     unset($xoopsblock, $xoopsgroup);
     return "<div{$style}>{$ret}</div>{$clear}";
 }
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:xoopsblock.inc.php

示例2: switch

 if (empty($bcachetime)) {
     $xoopsTpl->xoops_setCaching(0);
 } else {
     $xoopsTpl->xoops_setCaching(2);
     $xoopsTpl->xoops_setCacheTime($bcachetime);
 }
 $btpl = $block_arr[$i]->getVar('template') != '' ? $block_arr[$i]->getVar('template') : "system_block_dummy.html";
 if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) {
     $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
     $bresult =& $block_arr[$i]->buildBlock();
     if (!$bresult) {
         continue;
     }
     $xoopsTpl->assign_by_ref('block', $bresult);
     $bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
     $xoopsTpl->clear_assign('block');
 } else {
     $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
     $bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
 }
 switch ($block_arr[$i]->getVar('side')) {
     case XOOPS_SIDEBLOCK_LEFT:
         if (!isset($show_lblock)) {
             $xoopsTpl->assign('xoops_showlblock', 1);
             $show_lblock = 1;
         }
         $xoopsTpl->append('xoops_lblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent));
         break;
     case XOOPS_CENTERBLOCK_LEFT:
         if (!isset($show_cblock)) {
             $xoopsTpl->assign('xoops_showcblock', 1);
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:31,代码来源:header.php

示例3: make_cblock

function make_cblock()
{
    global $xoopsUser, $xoopsOption;
    $xoopsblock = new XoopsBlock();
    $cc_block = $cl_block = $cr_block = "";
    $arr = array();
    if ($xoopsOption['theme_use_smarty'] == 0) {
        if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
            include_once XOOPS_ROOT_PATH . '/class/template.php';
            $xoopsTpl = new XoopsTpl();
        } else {
            $xoopsTpl =& $GLOBALS['xoopsTpl'];
        }
        if (is_object($xoopsUser)) {
            $block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
        } else {
            $block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
        }
        $block_count = count($block_arr);
        $xoopsLogger =& XoopsLogger::instance();
        for ($i = 0; $i < $block_count; $i++) {
            $bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
            if (empty($bcachetime)) {
                $xoopsTpl->xoops_setCaching(0);
            } else {
                $xoopsTpl->xoops_setCaching(2);
                $xoopsTpl->xoops_setCacheTime($bcachetime);
            }
            $btpl = $block_arr[$i]->getVar('template');
            if ($btpl != '') {
                if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
                    $bresult =& $block_arr[$i]->buildBlock();
                    if (!$bresult) {
                        continue;
                    }
                    $xoopsTpl->assign_by_ref('block', $bresult);
                    $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
                    $xoopsTpl->clear_assign('block');
                } else {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
                    $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
                }
            } else {
                $bid = $block_arr[$i]->getVar('bid');
                if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
                    $bresult =& $block_arr[$i]->buildBlock();
                    if (!$bresult) {
                        continue;
                    }
                    $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
                    $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
                    $xoopsTpl->clear_assign('block');
                } else {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
                    $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
                }
            }
            $title = $block_arr[$i]->getVar('title');
            switch ($block_arr[$i]->getVar('side')) {
                case XOOPS_CENTERBLOCK_CENTER:
                    if ($title != "") {
                        $cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br /><br /></td></tr>' . "\n";
                    } else {
                        $cc_block .= '<tr><td colspan="2">' . $bcontent . '<br /><br /></td></tr>' . "\n";
                    }
                    break;
                case XOOPS_CENTERBLOCK_LEFT:
                    if ($title != "") {
                        $cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
                    } else {
                        $cl_block .= '<p>' . $bcontent . '</p>' . "\n";
                    }
                    break;
                case XOOPS_CENTERBLOCK_RIGHT:
                    if ($title != "") {
                        $cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
                    } else {
                        $cr_block .= '<p>' . $bcontent . '</p>' . "\n";
                    }
                    break;
                default:
                    break;
            }
            unset($bcontent, $title);
        }
        echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n";
    }
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:90,代码来源:old_functions.php


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