本文整理汇总了PHP中Loader::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::view方法的具体用法?PHP Loader::view怎么用?PHP Loader::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::view方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* assign the loaded class in the application to the $this var
*
*/
public function __construct()
{
$good = new Loader();
$this->load = $good->view("welcome/index.php");
print_r($this->load);
// print_r($this->load->view());
// log_message("debug","Controller class has been initialized");
}
示例2: Router
require SYSPATH . 'router.php';
require SYSPATH . 'loader.php';
require SYSPATH . 'controller.php';
require SYSPATH . 'model.php';
require SYSPATH . 'library.php';
require SYSPATH . 'i18n.php';
/*
* Understand URL and decompose route
*/
$router = new Router(empty($_SERVER['PATH_INFO']) ? '' : $_SERVER['PATH_INFO']);
$controller = $router->get_controller();
$method = $router->get_method();
$args = $router->get_args();
/*
* Load requested controller
*/
$not_found = true;
$controller_file = APPPATH . 'controllers/' . $controller . '.php';
if (file_exists($controller_file) && is_readable($controller_file)) {
include $controller_file;
$a = new $controller();
if (method_exists($a, $method)) {
$not_found = false;
call_user_func_array(array($a, $method), $args);
}
}
if ($not_found) {
http_response_code(404);
Loader::view($cfg['404_view'], $cfg['404_data']);
exit;
}
示例3: Router
*/
require SYSPATH . 'router.php';
require SYSPATH . 'loader.php';
require SYSPATH . 'controller.php';
require SYSPATH . 'model.php';
require SYSPATH . 'library.php';
/*
* Understand URL and decompose route
*/
$router = new Router(empty($_SERVER['PATH_INFO']) ? '' : $_SERVER['PATH_INFO']);
$controller = $router->get_controller();
$method = $router->get_method();
$args = $router->get_args();
/*
* Load requested controller
*/
$not_found = true;
$controller_file = APPPATH . 'controllers/' . $controller . '.php';
if (file_exists($controller_file) && is_readable($controller_file)) {
include $controller_file;
$a = new $controller();
if (method_exists($a, $method)) {
$not_found = false;
call_user_func_array(array($a, $method), $args);
}
}
if ($not_found) {
http_response_code(404);
Loader::view(404);
exit;
}
示例4: view
/**
* 编译视图
*/
function view($vname, $data = false, $cacheTime = 0, $cacheKey = '')
{
return Loader::view($vname, $data, $cacheTime, $cacheKey);
}
示例5: page
public function page($page = "welcome")
{
Loader::view("templates/header.php");
Loader::view("pages/" . $page . ".php");
Loader::view("templates/footer.php");
}
示例6: commentsView
public static function commentsView($id, $type, $backPage, $open = true)
{
$id = (int) $id;
$type = (string) $type;
$backPage = (string) $backPage;
$model = new Comments_Model();
// comments
$commentsObj = $model->commentsFor($id, $type);
$approvedCount = 0;
// counter of approved comments
$unapprovedCount = 0;
// counter of unapproved comments
$visibleCount = 0;
// counter of comments visible to user
// visibilityToken
if (!Users::isLogged() && isset($_SESSION['wmelon.comments.visibilityToken'])) {
$visibilityToken = $_SESSION['wmelon.comments.visibilityToken'];
}
// composing comments array
foreach ($commentsObj as $comment) {
// tools
$linkEnding = $comment->id . '/' . base64_encode($backPage . '#comment-' . $comment->id);
$comment->editHref = '%/comments/edit/' . $linkEnding;
$comment->deleteHref = '%/comments/delete/' . $comment->id . '/' . base64_encode($backPage . '#comments');
$comment->approveHref = '%/comments/approve/' . $linkEnding;
$comment->rejectHref = '%/comments/reject/' . $linkEnding;
// visibility
// (comment is visible if admin or comment is approved or comment visibility token match user's visibility token)
$comment->visible = Users::isLogged() || $comment->approved || $comment->visibilityToken == $visibilityToken && !empty($comment->visibilityToken);
if ($comment->visible) {
$visibleCount++;
}
// additional information (for admin)
if (Users::isLogged() && $comment->authorID === null) {
$comment->additionalInfo = $comment->authorEmail . '; IP:' . $comment->authorIP;
}
// if commented as logged user
$authorID = $comment->authorID;
if ($authorID !== null) {
// author's user data
$comment->author = Users::userData(1);
// CSS class (for admin comments distinction)
$comment->cssClass = 'adminComment';
}
// "awaiting moderation" CSS class
if (!$comment->approved) {
$comment->cssClass .= ' awaitingModerationComment';
}
// comments counter
if ($comment->approved) {
$approvedCount++;
} else {
$unapprovedCount++;
}
//--
$comments[] = $comment;
}
// form
$submitPage = 'comments/post/' . $id . '/' . $type . '/' . base64_encode($backPage);
$form = new Form('wmelon.comments.addComment', $submitPage, $backPage . '#commentForm-link');
$form->globalMessages = false;
$form->submitLabel = 'Zapisz';
// user data inputs (if not logged in)
if (!Users::isLogged()) {
// remembered user data
$name = $_SESSION['wmelon.comments.name'];
$email = $_SESSION['wmelon.comments.email'];
$website = $_SESSION['wmelon.comments.website'];
// inputs args
$name = array('value' => $name);
$email = array('value' => $email);
$website = array('value' => $website, 'labelNote' => '(Opcjonalnie)');
// adding inputs
$form->addInput('text', 'name', 'Imię', true, $name);
$form->addInput('email', 'email', 'Email', true, $email);
$form->addInput('url', 'website', 'Strona', false, $website);
}
// content input
$form->addInput('textarea', 'content', 'Komentarz');
// comments counter
$commentsCount = Users::isLogged() ? $commentsObj->rows : $approvedCount;
// number of visible (approved) comments - for user and all comments - for admin
if ($commentsCount > 0) {
$commentsCountStr = $commentsCount . ' ' . pl_inflect($commentsCount, 'komentarzy', 'komentarz', 'komentarze');
}
if (Users::isLogged() && $unapprovedCount > 0) {
$commentsCountStr .= ' <span class="important">(' . $unapprovedCount . ' do sprawdzenia!)</span>';
}
// view
$view = Loader::view('/comments/comments');
$view->comments = $comments;
$view->areComments = $commentsObj->exists;
$view->commentsCount = $commentsCountStr;
$view->visibleCount = $visibleCount;
$view->visibilityToken = $visibilityToken;
$view->id = $id;
$view->type = $type;
$view->backPage = $backPage;
$view->form = $form->generate();
$view->open = $open;
//.........这里部分代码省略.........
示例7: registry
<?php
// error_reporting(none);
require '../config.php';
require '../engine/registry.php';
require '../engine/loader.php';
$registry = new registry();
$loader = new Loader();
$user = $loader->model('user');
var_dump($user);
$user2 = $loader->model('User');
var_dump($user2);
$user3 = $loader->controller('user');
var_dump($user3);
$user4 = $loader->controller('User');
var_dump($user4);
$user5 = $loader->controller('errorUser');
$user6 = $loader->model('errorUser');
echo $view = $loader->view('user', array('user' => 123));
echo $view = $loader->view('user', array('user' => 123), 'haha', 'hehe');
echo $loader->view('erroruser');
示例8: View
function View($name)
{
return Loader::view($name);
}