本文整理汇总了PHP中View::load方法的典型用法代码示例。如果您正苦于以下问题:PHP View::load方法的具体用法?PHP View::load怎么用?PHP View::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Starting point for every page request. Loads required core modules, gets data from url and calls
* necessary modules to make things happen.
*/
public static function init()
{
if (!self::$_inited) {
self::$_inited = true;
foreach (self::$_requiredCore as $module) {
require_once ROOT . 'core/' . $module . '/' . $module . EXT;
}
// Set the Load::auto method to handle all class loading from now on
spl_autoload_register('Load::auto');
Load::loadSetupFiles();
// If CLI mode, everything thats needed has been loaded
if (IS_CLI) {
return;
}
date_default_timezone_set(Config::get('system.timezone'));
Event::trigger('caffeine.started');
// If maintenance mode has been set in the config, stop everything and load mainteance view
if (Config::get('system.maintenance_mode')) {
View::error(ERROR_MAINTENANCE);
} else {
list($route, $data) = Router::getRouteData();
if ($data) {
if (self::_hasPermission($route, $data)) {
list($module, $controller, $method) = $data['callback'];
$params = Router::getParams();
// Make sure controller words are upper-case
$conBits = explode('_', $controller);
foreach ($conBits as &$bit) {
$bit = ucfirst($bit);
}
$controller = implode('_', $conBits);
$controller = sprintf('%s_%sController', ucfirst($module), ucwords($controller));
// Call the routes controller and method
if (method_exists($controller, $method)) {
$response = call_user_func_array(array($controller, $method), $params);
if (!self::_isErrorResponse($response)) {
Event::trigger('module.response', array($response));
View::load($module, $controller, $method);
} else {
View::error($response);
}
} else {
Log::error($module, sprintf('The method %s::%s() called by route %s doesn\'t exist.', $controller, $method, $route));
View::error(ERROR_500);
}
} else {
View::error(ERROR_ACCESSDENIED);
}
} else {
if ($route !== '[index]' || !View::directLoad('index')) {
View::error(ERROR_404);
}
}
}
View::output();
Event::trigger('caffeine.finished');
} else {
die('Why are you trying to re-initialize Caffeine?');
}
}
示例2: statistic
function statistic()
{
$stat = array('NAME' => 'Авторизация');
$stat['STATISTIC'] = 'Пользователей в системе: ' . Users::getUsersCount();
$stat['STATISTIC'] .= ' Администраторов в системе: ' . Users::getAdminUsersCount();
return View::load(array('engine', 'statisticNode'), $stat);
}
示例3: index
/**
* Метод отображения главной страницы контроллера
*
* @return mixed
*/
function index()
{
if (func_num_args()) {
$nav = Navigation::loadMenu(func_get_args()[0]);
$str = array();
foreach ($nav as $key => $val) {
$val['alias'] = preg_replace('/[~^$\\/|]/', '', $val['alias']);
if ($val['parentId']) {
if (!array_key_exists($val['parentId'], $str)) {
$str[$val['parentId']] = array('HREF' => $val['href'], 'NAME' => $val['alias'], 'SUBMENU' => '');
}
$str[$val['parentId']]['SUBMENU'] = array('HREF' => $val['href'], 'NAME' => $val['alias']);
continue;
}
if (array_key_exists($val['id'], $str)) {
$str[$val['id']]['HREF'] = $val['href'];
$str[$val['id']]['NAME'] = $val['alias'];
} else {
$str[$val['id']] = array('HREF' => $val['href'], 'NAME' => $val['alias']);
}
}
$arr = array('NODES' => '');
foreach ($str as $val) {
if (!empty($val['SUBMENU'])) {
$tmp = array('NODES' => View::load(array(Settings::$ENGINE['template'], 'navigationNode'), $val['SUBMENU']));
$val['SUBMENU'] = View::load(array(Settings::$ENGINE['template'], 'navigation'), $tmp);
}
$arr['NODES'] .= View::load(array(Settings::$ENGINE['template'], 'navigationNode'), $val);
}
return View::load(array(Settings::$ENGINE['template'], 'navigation'), $arr);
}
return null;
}
示例4: index
function index()
{
$posts = array(array('id' => 125923, 'slug' => 'the-most-awesome-post-ever', 'title' => 'The Most Awesome Post! Ever!', 'posted' => '2010-09-01 02:0:00', 'text' => '<p>This is the most awesome post. ever</p><p>And the second line of it.</p>'), array('id' => 125922, 'slug' => 'the-second-most-awesome-post-ever', 'title' => 'The Second Most Awesome Post! Ever!', 'posted' => '2010-09-01 01:00:00', 'text' => '<p>This is the second most awesome post. ever</p><p>And the second line of it.</p>'));
$this->blogposts = $posts;
$this->title = "Blog";
$this->sitename = "MySite";
View::load('blog/default.php', $this);
}
示例5: index
function index()
{
$arr = array();
$arr["select"] = FeedBackModel::getSelect();
$arr["name"] = "Имя";
$arr["siti"] = "Город";
$arr["Email"] = "Email";
return View::load(array(Settings::$ENGINE['template'], 'FeedBackForm'), $arr);
}
示例6: loadView
function loadView($route)
{
$layout = 'default';
if (isset($route->action['Layout'])) {
$layout = $route->action['Layout'];
}
$view = new View();
$view->load($route->action['View'], $layout);
}
示例7: __destruct
public function __destruct()
{
if (defined('AUTO_HEADER')) {
if (AUTO_HEADER) {
$this->template = View::load('html_header') . $this->template . View::load('html_footer');
}
}
echo $this->template;
}
示例8: testView
function testView()
{
$view = new View();
$view->no_layout = true;
$view->load("test_view");
$view->data("test", "World");
ob_start();
$view->dump(array("controller" => "testz", "action" => "test"));
$output = ob_get_contents();
ob_end_clean();
$this->assertEqual($output, "Hello World");
}
示例9: onAppExit
function onAppExit($render = TRUE)
{
if (APP_USE_CART) {
$this->_shoppingCart->save();
}
$ltime = microtime() - MateApplication::$startTime;
Logger::log("LogicTime", "{$ltime} segs");
Logger::log("RenderTime", "{PUT_RENDER_TIME_HERE} segs");
Logger::log("TotalTime", "{PUT_TOTAL_TIME_HERE} segs");
$renderStart = microtime();
import("view.Cache");
if ($render !== FALSE) {
if (APP_USE_TEMPLATES) {
if (APP_DEBUG_MODE) {
$debugContent = Config::exists("APP_DEBUG_TEMPLATE") ? View::load(APP_DEBUG_TEMPLATE, array("debug" => Logger::render(console))) : "<div class=\"debug\">" . Logger::render(console) . "</div>";
$this->view->set("debug", $debugContent);
}
switch ($render) {
case "referer":
echo redirectToReferer();
return false;
die("");
case "error404":
header("HTTP/1.0 404 Not Found");
$this->setContent("error/404");
break;
default:
// $result = $this->view->render();
break;
}
$result = $this->view->render();
/*$cache = new Cache("cache");
$ca*/
if (VIEW_USE_TIDY) {
if (function_exists(tidy)) {
$config = array('indent' => true, 'output-xhtml' => true, 'wrap' => 200);
$tidy = new tidy();
$tidy->parseString($result, $config, 'utf8');
$tidy->cleanRepair();
$result = $tidy;
}
}
echo str_replace(array("{PUT_RENDER_TIME_HERE}", "{PUT_TOTAL_TIME_HERE}"), array(microtime() - $renderStart, microtime() - MateApplication::$startTime), $result);
} else {
if (APP_DEBUG_MODE) {
echo "<div class=\"debug\">" . Logger::render("console") . "</div>";
}
}
} else {
//if(APP_DEBUG_MODE) echo "<div class=\"debug\">".Logger::render()."</div>";
}
//echo Logger::log("LogicTime",MateApplication::$endTime-MateApplication::$startTime);
}
示例10: view
public function view()
{
Kit::$login->checkLogin(2);
View::load("arquivos_view", ACCEPTING_PARAMS);
}
示例11: Producto
<?php
require 'vendor/autoload.php';
$modeloProducto = new Producto();
$productos = $modeloProducto->todosLosProductos();
View::load('index', ['productos' => $productos]);
示例12:
}
?>
</div><!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<?php
// puedo cargar otras funciones iniciales
// dentro de la funcion donde cargo la vista actual
// como por ejemplo cargar el corte actual
View::load("start");
?>
</div><!-- /#page-wrapper -->
</div><!-- /#wrapper -->
<!-- JavaScript -->
<?php
if (Session::getUID() != "") {
$channels = ChannelData::getAllByUID(Session::getUID());
if (count($channels) > 0) {
$channel = $channels[0];
?>
示例13: index
function index()
{
View::load('boki/index.php');
}
示例14: header
<?php
require 'vendor/autoload.php';
if (!is_int((int) $_GET['id']) || $_GET['id'] < 1) {
header('Location:index.php');
}
$modeloProducto = new Producto();
$producto = $modeloProducto->traerProducto($_GET['id'])[0];
View::load('producto', ['producto' => $producto]);
示例15:
</div>
<button type="submit" class="btn btn-default">Entrar</button>
</form>
</li>
<?php
}
?>
</ul>
</nav>
</div>
</header>
<!-- - - - - - - - - - - - - - - -->
<?php
View::load("index");
?>
<!-- - - - - - - - - - - - - - - -->
<br><br>
<div class="container">
<div class="row">
<div class="col-md-12">
<hr/>
</div>
</div>
<div class="row">
<div class="col-md-3">
<h4>ENLACES</h4>
<ul>
<li><a href="./?view=changelog">Log de Cambios</a></li>
<li><a href="http://evilnapsis.com">Evilnapsis HomePage</a></li>