本文整理汇总了PHP中Block::set_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::set_vars方法的具体用法?PHP Block::set_vars怎么用?PHP Block::set_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::set_vars方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Block
function test_block_with_vars()
{
// Reads from test/templates/block-test.php
$block = new Block('test');
$block->set_vars(array('foo' => 'bar', 'janf' => 'quux'));
$this->assertEqual("test block\nfoo=bar\njanf=quux\n", $block->render());
}
示例2: recursive_unset
function recursive_unset(&$array, $unwanted_key) {
unset($array[$unwanted_key]);
foreach ($array as &$value) {
if (is_array($value)) {
recursive_unset($value, $unwanted_key);
}
}
}
$tmp_record = $RECORD;
recursive_unset($tmp_record, 'module');
print_r($tmp_record);
?>
</pre>
</div>
<? endif /* Debug view*/ ?>
<?php
/*### TEMP: add sidebar blocks TODO: make this configurable ###*/
// Added in reverse order
// Citation
$block = new Block('citation');
$block->set_vars(array('CONF' => $CONF, 'RECORD' => $RECORD, 'MODULE' => $MODULE));
array_unshift($SIDEBAR, $block);
// Mark record
$block = new Block('mark_record');
$block->set_vars(array('CONF' => $CONF, 'RECORD' => $RECORD, 'MODULE' => $MODULE, 'MARKED_RECORDS' => $MARKED_RECORDS, 'USER' => $USER));
array_unshift($SIDEBAR, $block);
?>
<?php
require_once $CONF['path_templates'] . 'inc-footer.php';
示例3: Block
<?php
// $Id$
// Footer for database applications
// James Fryer, 30 Aug 08
// BUFVC Potnia copyright 2011, BUFVC et al. See LICENSE for licensing information (GPL3). See http://potnia.org, http://bufvc.ac.uk
// Include logo when on module default page
if (@$SIDEBAR == '') {
$logo = new Block('logo');
$logo->set_vars(compact('MODULE', 'CONF'));
$SIDEBAR = array($logo);
}
?>
</div>
<div class="sidebar-wrapper column_5 last_column">
<?if (@$SIDEBAR):?>
<div class="sidebar" id="sidebar">
<ul>
<?php
/*---- Blocks -----*/
?>
<? foreach ($SIDEBAR as $block): ?>
<li><?php
echo $block->render();
?>
</li>
<? endforeach ?>
</ul>
</div> <!-- sidebar -->
<? endif /* Sidebar */ ?>
</div> <!-- sidebar-wrapper -->