Файл: system/classes/Template.php
Строк: 38
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class Template
{
public static function view($_viewFile_, $_data_ = null, $_return_ = false)
{
$ext = '.php';
// we use special variable names here to avoid conflict when extracting data
if(is_array($_data_))
extract($_data_, EXTR_PREFIX_SAME, 'data');
else
$data = $_data_;
if($_return_)
{
ob_start();
ob_implicit_flush(false);
if(file_exists(Core::themePath().'/'.$_viewFile_.$ext))
{
require(Core::themePath().'/'.$_viewFile_.$ext);
}
else
{
require(SYS.'/views/'.$_viewFile_.$ext);
}
return ob_get_clean();
}
else
{
if(file_exists(Core::themePath().'/'.$_viewFile_.$ext))
{
require(Core::themePath().'/'.$_viewFile_.$ext);
}
else
{
require(SYS.'/views/'.$_viewFile_.$ext);
}
}
}
public static function div($class, $value)
{
echo '<div class="'.$class.'">'.$value.'</div>';
}
}