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


PHP XoopsTpl::assign_by_ref方法代码示例

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


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

 foreach (array_keys($block_arr) as $i) {
     $bcachetime = $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') != '' ? $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:
开发者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

示例4: render

 /**
  * Render the page
  *
  * The theme engine builds pages from 2 templates: canvas and content.
  *
  * A module can call this method directly and specify what templates the theme engine must use.
  * If render() hasn't been called before, the theme defaults will be used for the canvas and
  * page template (and xoopsOption['template_main'] for the content).
  *
  * @param string $canvasTpl  The canvas template, if different from the theme default
  * @param string $pageTpl    The page template, if different from the theme default (unsupported, 2.3+ only)
  * @param string $contentTpl The content template
  * @param array  $vars       Template variables to send to the template engine
  *
  * @return bool
  */
 public function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array())
 {
     if ($this->renderCount) {
         return false;
     }
     $xoopsLogger = XoopsLogger::getInstance();
     $xoopsLogger->startTime('Page rendering');
     xoops_load('xoopscache');
     $cache = XoopsCache::getInstance();
     //Get meta information for cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && ($content = $cache->read($this->contentCacheId))) {
         //we need to merge metas set by blocks ) with the module cached meta
         $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']);
         foreach ($content['metas'] as $type => $value) {
             $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]);
         }
         $GLOBALS['xoopsOption']['xoops_pagetitle'] = $content['xoops_pagetitle'];
         $GLOBALS['xoopsOption']['xoops_module_header'] = $content['header'];
     }
     if (!empty($GLOBALS['xoopsOption']['xoops_pagetitle'])) {
         $this->template->assign('xoops_pagetitle', $GLOBALS['xoopsOption']['xoops_pagetitle']);
     }
     $header = empty($GLOBALS['xoopsOption']['xoops_module_header']) ? $this->template->get_template_vars('xoops_module_header') : $GLOBALS['xoopsOption']['xoops_module_header'];
     //save meta information of cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) {
         $content['htmlHeadStrings'] = $this->htmlHeadStrings;
         $content['metas'] = $this->metas;
         $content['xoops_pagetitle'] =& $this->template->get_template_vars('xoops_pagetitle');
         $content['header'] = $header;
         $cache->write($this->contentCacheId, $content);
     }
     //  @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice
     $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright');
     foreach ($this->metas['meta'] as $name => $value) {
         if (in_array($name, $old)) {
             $this->template->assign("xoops_meta_{$name}", htmlspecialchars($value, ENT_QUOTES));
             unset($this->metas['meta'][$name]);
         }
     }
     // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ?
     $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header);
     if ($canvasTpl) {
         $this->canvasTemplate = $canvasTpl;
     }
     if ($contentTpl) {
         $this->contentTemplate = $contentTpl;
     }
     if (!empty($vars)) {
         $this->template->assign($vars);
     }
     if ($this->contentTemplate) {
         $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId);
     }
     if ($this->bufferOutput) {
         $this->content .= ob_get_contents();
         ob_end_clean();
     }
     $this->template->assign_by_ref('xoops_contents', $this->content);
     // Do not cache the main (theme.html) template output
     $this->template->caching = 0;
     //mb -------------------------
     //        $this->template->display($this->path . '/' . $this->canvasTemplate);
     if (file_exists($this->path . '/' . $this->canvasTemplate)) {
         $this->template->display($this->path . '/' . $this->canvasTemplate);
     } else {
         $this->template->display($this->path . '/theme.tpl');
     }
     //mb -------------------------
     $this->renderCount++;
     $xoopsLogger->stopTime('Page rendering');
     return true;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:88,代码来源:theme.php

示例5: render

 /**
  * Render the page
  *
  * The theme engine builds pages from 2 templates: canvas and content.
  *
  * A module can call this method directly and specify what templates the theme engine must use.
  * If render() hasn't been called before, the theme defaults will be used for the canvas and
  * page template (and xoopsOption['template_main'] for the content).
  *
  * @param string $canvasTpl The canvas template, if different from the theme default
  * @param string $pageTpl The page template, if different from the theme default (unsupported, 2.3+ only)
  * @param string $contentTpl The content template
  * @param array $vars Template variables to send to the template engine
  */
 function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array())
 {
     if ($this->renderCount) {
         return false;
     }
     $xoopsLogger =& XoopsLogger::getInstance();
     $xoopsLogger->startTime('Page rendering');
     //  @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice
     $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright');
     foreach ($this->metas['meta'] as $name => $value) {
         if (in_array($name, $old)) {
             $this->template->assign("xoops_meta_{$name}", htmlspecialchars($value, ENT_QUOTES));
             unset($this->metas['meta'][$name]);
         }
     }
     if ($canvasTpl) {
         $this->canvasTemplate = $canvasTpl;
     }
     if ($contentTpl) {
         $this->contentTemplate = $contentTpl;
     }
     if (!empty($vars)) {
         $this->template->assign($vars);
     }
     if ($this->contentTemplate) {
         $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId);
     }
     if ($this->bufferOutput) {
         $this->content .= ob_get_contents();
         ob_end_clean();
     }
     $this->template->assign_by_ref('xoops_contents', $this->content);
     // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ?
     $header = empty($GLOBALS['xoopsOption']['xoops_module_header']) ? $this->template->get_template_vars('xoops_module_header') : $GLOBALS['xoopsOption']['xoops_module_header'];
     $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header);
     if (!empty($GLOBALS['xoopsOption']['xoops_pagetitle'])) {
         $this->template->assign('xoops_pagetitle', $GLOBALS['xoopsOption']['xoops_pagetitle']);
     }
     // Do not cache the main (theme.html) template output
     $this->template->caching = 0;
     $this->template->display($this->path . '/' . $this->canvasTemplate);
     $this->renderCount++;
     $xoopsLogger->stopTime('Page rendering');
 }
开发者ID:yunsite,项目名称:xoopsdc,代码行数:58,代码来源:theme.php

示例6: checkEmail

    $xml->setVar("descriptionHtmlSyndicated", true);
    $xml->setVar("link", $xml_link);
    $xml->setVar("syndicationURL", XOOPS_URL . "/" . xoops_getenv("PHP_SELF"));
    $xml->setVar("webmaster", checkEmail($xoopsConfig["adminmail"], true));
    $xml->setVar("editor", checkEmail($xoopsConfig["adminmail"], true));
    $xml->setVar("category", $xoopsModule->getVar("name"), true);
    $xml->setVar("generator", $xoopsModule->getInfo("version"));
    $xml->setVar("language", _LANGCODE);
    $dimention = @getimagesize(XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/" . $xoopsModule->getInfo("image"));
    $image = array("width" => @$dimention[0], "height" => @$dimention[1], "title" => $xoopsConfig["sitename"] . " :: " . $pagetitle, "url" => XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/" . $xoopsModule->getInfo("image"), "link" => XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/", "description" => $rssdesc);
    $xml->setImage($image);
    /*
    $item = array(
    "title" => $datatitle,
    "link" => $dataurl,
    "description" => $datadesc,
    "descriptionHtmlSyndicated" => true,
    "date" => $datadate,
    "source" => $datasource,
    "author" => $dataauthor
    );
    */
    $xml->addItems($items);
    //$dummy_content = $xml_handler->display($xml, XOOPS_CACHE_PATH."/".$GLOBALS["artdirname"].".xml.tmp");
    $dummy_content = $xml_handler->display($xml);
    $tpl->assign_by_ref('dummy_content', $dummy_content);
}
//$content = ob_get_contents();
ob_end_clean();
header('Content-Type:text/xml; charset=' . $xml_charset);
$tpl->display('db:system_dummy.html', $xoopsCachedTemplateId);
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:xml.php

示例7:

 $bcachetime = $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, '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'));
     }
 } 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']);
开发者ID:nao-pon,项目名称:HypCommon,代码行数:31,代码来源:header.php


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