本文整理汇总了PHP中core::vars方法的典型用法代码示例。如果您正苦于以下问题:PHP core::vars方法的具体用法?PHP core::vars怎么用?PHP core::vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::vars方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file
<?
$block= file(core::config('data-path').'block1.txt');
core::vars('headline1', $block[0]);
core::vars('subheadline1', $block[1]);
unset($block[0]);
unset($block[1]);
core::vars('text1', '<p>'.implode('</p><p>',$block).'</p>');
$block= file(core::config('data-path').'block2.txt');
core::vars('headline2', $block[0]);
core::vars('subheadline2', $block[1]);
unset($block[0]);
unset($block[1]);
core::vars('text2', '<p>'.implode('</p><p>',$block).'</p>');
示例2: file_get_contents
<?
$data= file_get_contents('http://api.fixer.io/latest');
$data= json_decode($data);
core::vars('rates',$data);
示例3: if
?>
<div style="float:right;">
<? if (!core::req('.hide-image')): ?>
<img src="sample.jpg" style="max-width:400px; margin-left:2em;">
<? endif ?>
</div>
<?php
echo core::vars('text1');
?>
</div>
<? if(cms::admin()): ?>
<?
$c= cms::context() -> label('Edit') -> icon('edit') -> popup(core::url('edit-block','no',2)) -> popuptitle('Edit text block 2');
echo cms::anchor($c,'Block 2');
?>
<div>
<h1><?php
echo core::vars('headline2');
?>
</h1>
<h2><?php
echo core::vars('subheadline2');
?>
</h2>
<?php
echo core::vars('text2');
?>
</div>
<? endif ?>
示例4: foreach
<? core::prepend('head','title','Another page - ConKit test') ?>
<h1>Hello again</h1>
This is just another sample page. But it has some business logic done behind.
It retrives latest exchange rate. See <i>other.mod.php</i> for that.
<h2>Currency Exchange Rates on <?php
echo core::vars('rates')->date;
?>
</h2>
<h4>Comparing to <?php
echo core::vars('rates')->base;
?>
</h4>
<div style="-webkit-column-count:3; -moz-column-count:3; column-count:3;">
<? foreach (get_object_vars(core::vars('rates')->rates) as $symbol=>$rate): ?>
<div>
<?php
echo $symbol;
?>
-- <?php
echo $rate;
?>
</div>
<? endforeach ?>
</div>