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


PHP XoopsTpl::get_template_vars方法代码示例

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


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

示例1: foreach

 function &get_template_vars($name = null)
 {
     $root =& XCube_Root::getSingleton();
     if (!isset($name)) {
         foreach ($this->_mContextReserve as $t_key => $t_value) {
             if (isset($this->_mContextReserve[$t_value])) {
                 $this->_tpl_vars[$t_key] = htmlspecialchars($root->mContext->getAttribute($this->_mContextReserve[$t_value]), ENT_QUOTES);
             }
         }
         $value =& parent::get_template_vars($name);
     } elseif (isset($this->_mContextReserve[$name])) {
         $value = htmlspecialchars($root->mContext->getAttribute($this->_mContextReserve[$name]), ENT_QUOTES);
     } else {
         $value =& parent::get_template_vars($name);
     }
     return $value;
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:17,代码来源:Legacy_RenderSystem.class.php

示例2: 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

示例3: xnpbookGetEditBlock

function xnpbookGetEditBlock($item_id)
{
    $textutil =& xoonips_getutility('text');
    $formdata =& xoonips_getutility('formdata');
    // get BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationEditBlock($item_id);
    $index = xnpGetIndexEditBlock($item_id);
    $attachment = xnpGetAttachmentEditBlock($item_id, 'book_pdf');
    // get DetailInformation
    $detail = xnpbookGetDetailInformation($item_id);
    // override values if post form request
    foreach (_xnpbook_get_detail_request(true) as $key => $val) {
        if ($val !== null) {
            $detail[$key]['value'] = $val;
        }
    }
    // html special chars for each value
    foreach ($detail as $key => $val) {
        $detail[$key]['value'] = $textutil->html_special_chars($detail[$key]['value']);
    }
    // check amazon access key and secret access key
    $mydirname = basename(dirname(dirname(__FILE__)));
    $mhandler =& xoops_gethandler('module');
    $module =& $mhandler->getByDirname($mydirname);
    $chandler =& xoops_gethandler('config');
    $mconfig = $chandler->getConfigsByCat(false, $module->mid());
    $amazon_key_exist = true;
    if (empty($mconfig['AccessKey']) || empty($mconfig['SecretAccessKey']) || empty($mconfig['AssociateTag'])) {
        $amazon_key_exist = false;
    }
    // set to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('index', $index);
    $tpl->assign('attachment', $attachment);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionEditBlock('xnpbook', xnpbookGetAttachmentDownloadLimitOption($item_id)));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionEditBlock('xnpbook', xnpbookGetAttachmentDownloadNotifyOption($item_id)));
    $tpl->assign('detail', $detail);
    $tpl->assign('system_message', $tpl->get_template_vars('system_message'));
    $tpl->assign('is_register', false);
    $tpl->assign('myurl', XOOPS_URL . '/modules/xoonips/edit.php');
    $formdata =& xoonips_getutility('formdata');
    if (!$formdata->getValue('get', 'post_id', 's', false)) {
        $detail_handler =& xoonips_getormhandler('xnpbook', 'item_detail');
        $detail_orm =& $detail_handler->get($item_id);
        $tpl->assign('xnpbook_author', xoonips_get_multiple_field_template_vars($detail_orm->getAuthors(), 'xnpbook', 'author'));
    } else {
        $tpl->assign('xnpbook_author', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnpbook', 'author'), 'xnpbook', 'author'));
    }
    $tpl->assign('amazon_key_exist', $amazon_key_exist);
    // return as HTML
    return $tpl->fetch('db:xnpbook_register_block.html');
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:56,代码来源:view.php

示例4: _isBlockPrepared

 /**
  * ブロックが準備されているかを返す
  * @returns bool 準備されていればTRUE, そうでなければFALSE
  */
 protected function _isBlockPrepared(XoopsTpl $xoopsTpl)
 {
     return $xoopsTpl->get_template_vars('xoops_showlblock') !== null;
 }
开发者ID:nouphet,项目名称:xoopscube-preloads,代码行数:8,代码来源:SampleGetBlockContent.class.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
  *
  * @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

示例6: eval

}
include_once XOOPS_ROOT_PATH . '/modules/' . $itemtype['viewphp'];
eval("\$body = " . $modname . "GetDetailBlock( \$item_id );");
$xoopsTpl->assign('body', $body);
$func = $modname . "GetDownloadConfirmationBlock";
if (function_exists($func)) {
    $xoopsTpl->assign('download_confirmation', $func($item_id, $download_file_id));
} else {
    $xoopsTpl->assign('download_file_id', $download_file_id);
}
$xoonips_module_header = '<link rel="stylesheet" type="text/css" href="style.css" />';
$func = $modname . 'GetHeadMeta';
if (function_exists($func)) {
    eval('$xoonips_module_header .= "\\n".' . $func . '($item_id);');
}
$xoonips_module_header .= "\n" . $xoopsTpl->get_template_vars('xoops_module_header');
$xoopsTpl->assign('xoops_module_header', $xoonips_module_header);
// Record events(view item)
$eventlog_handler =& xoonips_getormhandler('xoonips', 'event_log');
$eventlog_handler->recordViewItemEvent($item_id);
$basic = xnpGetBasicInformationArray($item_id);
$xoopsTpl->assign('xoops_pagetitle', $textutil->html_special_chars($basic['titles'][0]));
// get item viewed count
$ranking_handler =& xoonips_gethandler('xoonips', 'ranking');
$ranking_handler->update();
$viewed_count = $ranking_handler->get_count_viewed_item($item_id);
$xoopsTpl->assign('viewed_count', $viewed_count);
//start of item comment function
$comconfig_handler =& xoonips_getormhandler('xoonips', 'config');
$com_dir_name = $comconfig_handler->getValue('item_comment_dirname');
$com_forum_id = $comconfig_handler->getValue('item_comment_forum_id');
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:detail.php

示例7: 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

示例8: array

        case XOOPS_SIDEBLOCK_RIGHT:
            if (!isset($show_rblock)) {
                $xoopsTpl->assign('xoops_showrblock', 1);
                $show_rblock = 1;
            }
            $xoopsTpl->append('xoops_rblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
            break;
    }
    unset($bcontent);
}
// FALLBACK inserting admin_menu_block in admin side
if (!$adminmenublock_exists) {
    require_once XOOPS_ROOT_PATH . '/modules/altsys/blocks/blocks.php';
    $admin_menu_block = array(b_altsys_admin_menu_show(array('altsys')));
    $admin_menu_block[0]['title'] = 'Admin Menu';
    $lblocks = $xoopsTpl->get_template_vars('xoops_lblocks');
    if (!is_array($lblocks)) {
        $lblocks = array();
    }
    $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks));
}
//unset($block_arr);
if (!isset($show_lblock)) {
    $xoopsTpl->assign('xoops_showlblock', 0);
}
if (!isset($show_rblock)) {
    $xoopsTpl->assign('xoops_showrblock', 0);
}
if (!isset($show_cblock)) {
    $xoopsTpl->assign('xoops_showcblock', 0);
}
开发者ID:hiro1173,项目名称:legacy,代码行数:31,代码来源:admin_in_theme_header.inc.php

示例9: xnpsimulatorGetConfirmBlock

function xnpsimulatorGetConfirmBlock($item_id)
{
    $textutil =& xoonips_getutility('text');
    $formdata =& xoonips_getutility('formdata');
    $developer_handler =& xoonips_getormhandler('xnpsimulator', 'developer');
    $developer_objs =& $formdata->getObjectArray('post', $developer_handler->getTableName(), $developer_handler, false);
    // retrive detail information
    $detail = array();
    $simulator_type = $formdata->getValue('post', 'simulator_type', 's', false);
    if ($simulator_type !== false) {
        $simulator_types = xnpsimulator_get_type_array();
        $detail['simulator_type'] = array('value' => $textutil->html_special_chars($simulator_type), 'display_value' => $textutil->html_special_chars($simulator_types[$simulator_type]));
    }
    // retrieve blocks of BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationConfirmBlock($item_id);
    xnpConfirmHtml($detail, 'xnpsimulator_item_detail', array_keys($detail), _CHARSET);
    $preview = xnpGetPreviewConfirmBlock($item_id);
    $attachment = xnpGetAttachmentConfirmBlock($item_id, 'simulator_data');
    $index = xnpGetIndexConfirmBlock($item_id);
    $lengths = xnpGetColumnLengths('xnpsimulator_item_detail');
    $readme = xnpGetTextFileConfirmBlock($item_id, 'readme', $lengths['readme']);
    $rights = xnpGetRightsConfirmBlock($item_id, $lengths['rights']);
    if (xnpHasWithout($basic) || xnpHasWithout($detail) || xnpHasWithout($preview) || xnpHasWithout($attachment) || xnpHasWithout($readme) || xnpHasWithout($rights) || xoonips_is_multiple_field_too_long($developer_objs, 'xnpsimulator', 'developer')) {
        global $system_message;
        $system_message = $system_message . "\n<br /><font color='#ff0000'>" . _MD_XOONIPS_ITEM_WARNING_FIELD_TRIM . '</font><br />';
    }
    // assign to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // variables assigned to xoopsTpl are copied to tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('attachment', $attachment);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionConfirmBlock('xnpsimulator'));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionConfirmBlock('xnpsimulator'));
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    if (isset($simulator_date)) {
        $tpl->assign('simulator_date', $simulator_date);
        if ($simulator_date['Date_Year']) {
            $tpl->assign('system_message', $tpl->get_template_vars('system_message') . '<br/><font color=\'#ff0000\'>' . _MD_XOONIPS_ITEM_TITLE_REQUIRED . '</font>');
        }
    }
    $tpl->assign('xnpsimulator_developer', xoonips_get_multiple_field_template_vars($developer_objs, 'xnpsimulator', 'developer'));
    // return HTML content
    return $tpl->fetch('db:xnpsimulator_confirm_block.html');
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:50,代码来源:view.php


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