本文整理汇总了PHP中View::output方法的典型用法代码示例。如果您正苦于以下问题:PHP View::output方法的具体用法?PHP View::output怎么用?PHP View::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::output方法的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: output
/**
* buffers the top view before outputting the layout
*
* @return void
*/
public function output($json = false, $id = null)
{
if ($this->topView() !== null) {
$this->topView()->buffer();
}
parent::output();
}
示例3: action
public function action()
{
if ($this->check()) {
if (!AUTHENICATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'index', true);
return;
}
if (AUTHENICATED && !ACTIVATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'characters', true);
return;
}
$Id = $_GET[0];
$View = new View();
new ControllerHelper($View, 'page-hard-article');
$Article = $this->Manhattan->GetModel()->prepare('SELECT * FROM sulake_news WHERE id = ?')->bind(array($Id))->execute();
if ($Article->num_rows() == 0) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'me', true);
}
while ($A = $Article->fetch_array()) {
$View->set(array('article_title' => $A['title'], 'article_author' => $A['author'], 'article_date' => $A['date'], 'article_story' => nl2br($A['story']), 'article_image' => $A['image'], 'article_id' => $Id, 'page-tagline' => $A['title']));
}
foreach ($_SESSION['habbo'] as $Key => $Value) {
$View->set(array('habbo_' . $Key => $Value));
}
$View->set(array('page-title' => $this->Manhattan->Config['Site']['Title'], 'site_title' => $this->Manhattan->Config['Site']['Title'], 'users_online' => 0, 'query_count' => $this->Manhattan->GetModel()->_count, 'exec_time' => round(microtime(true) - $this->Manhattan->Start, 3)));
echo $View->output();
} else {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'error');
}
}
示例4: action
public function action()
{
if ($this->check()) {
if (!AUTHENICATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'index', true);
return;
}
if (AUTHENICATED && !ACTIVATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'characters', true);
return;
}
$Exists = file_get_contents('Storage/Cache/Looks/' . $_SESSION['habbo']['look'] . '.png');
$HabboLook = file_get_contents('http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $_SESSION['habbo']['look'] . '.gif');
if ($Exists && $HabboLook && $Exists != $HabboLook) {
file_put_contents('Storage/Cache/Looks/' . $_SESSION['habbo']['look'] . '.png', file_get_contents('http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $_SESSION['habbo']['look'] . '.gif'));
}
$View = new View();
new ControllerHelper($View, 'page-me');
foreach ($_SESSION['habbo'] as $Key => $Value) {
$View->set(array('habbo_' . $Key => $Value));
}
$View->set(array('page-title' => $this->Manhattan->Config['Site']['Title'], 'page-tagline' => $_SESSION['habbo']['username'], 'site_title' => $this->Manhattan->Config['Site']['Title'], 'users_online' => 0, 'query_count' => $this->Manhattan->GetModel()->_count, 'exec_time' => round(microtime(true) - $this->Manhattan->Start, 3)));
echo $View->output();
} else {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'error');
}
}
示例5: action
public function action()
{
if ($this->check()) {
if (!AUTHENICATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'index', true);
return;
}
if (AUTHENICATED && !ACTIVATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'characters', true);
return;
}
$View = new View('page-client');
$View->javascript('swfobject');
$this->Manhattan->GetModel()->prepare('UPDATE users SET auth_ticket = ? WHERE id = ?')->bind(array('sulake.' . $_SESSION['habbo']['username'], $_SESSION['habbo']['id']))->execute();
$_SESSION['habbo']['auth_ticket'] = 'sulake.' . $_SESSION['habbo']['username'];
$this->Manhattan->GetModel()->prepare('UPDATE users SET ip_last = ?, ip_reg = ? WHERE id = ?')->bind(array(IP_ADDRESS, IP_ADDRESS, $_SESSION['habbo']['id']))->execute();
foreach ($_SESSION['habbo'] as $Key => $Value) {
$View->set(array('habbo_' . $Key => $Value));
}
$View->set(array('page-title' => $this->Manhattan->Config['Site']['Title'], 'page-tagline' => 'Index'));
echo $View->output();
} else {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'error');
}
}
示例6: edit
public function edit($id)
{
$view = new View("product/edit.php");
$modelProduct = new Product();
$product = $modelProduct->getProduct($id);
$view->set('product', $product);
$view->output();
}
示例7: Model
function mvc_plugin_render()
{
$model = new Model($this->path);
$controller = new Controller($model);
$view = new View($model);
if (isset($_REQUEST['mvc_view'])) {
$controller->render($_REQUEST['mvc_view']);
}
$view->output();
}
示例8: raise_error
function raise_error($error)
{
// init the view library
$view = new View();
// assign the error message
$view->assign('error_msg', $error);
// add the 'error' view
$view->add('error');
// output view
$view->output();
// end script execution
exit;
}
示例9: action
public function action()
{
$_view = new View('404');
$Array = explode('/', CURRENT);
$Current = null;
if ($Array) {
$Request = end($Array);
$Current = $Request . '.php';
} else {
$Current = CURRENT . '.php';
}
$_view->set(array('page-title' => '404', 'page-tagline' => 'File Not Found!', 'current_date' => date('h:m'), 'website_name' => URL, 'webmaster' => WEBMASTER, 'url' => $Current));
echo $_view->output();
}
示例10: action
public function action()
{
if ($this->check()) {
if (!AUTHENICATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'index', true);
return;
}
$View = new View();
new ControllerHelper($View, 'page-characters');
$View->set(array('page-title' => $this->Manhattan->Config['Site']['Title'], 'page-tagline' => 'Characters', 'site_title' => $this->Manhattan->Config['Site']['Title'], 'users_online' => 0));
echo $View->output();
} else {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'error');
}
}
示例11: loginPage
/**
* 登录页面
*/
public static function loginPage($errorCode = NULL)
{
Option::get('login_code') == 'y' ? $ckcode = "<span>验证码</span>\r\n <div class=\"val\"><input name=\"imgcode\" id=\"imgcode\" type=\"text\" />\r\n <img src=\"../include/lib/checkcode.php\" align=\"absmiddle\"></div>" : ($ckcode = '');
$error_msg = '';
if ($errorCode) {
switch ($errorCode) {
case self::LOGIN_ERROR_AUTHCODE:
$error_msg = '验证错误,请重新输入';
break;
case self::LOGIN_ERROR_USER:
$error_msg = '用户名错误,请重新输入';
break;
case self::LOGIN_ERROR_PASSWD:
$error_msg = '密码错误,请重新输入';
break;
}
}
require_once View::getView('login');
View::output();
}
示例12: action
public function action()
{
if ($this->check()) {
if (!AUTHENICATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'index', true);
return;
}
if (AUTHENICATED && !ACTIVATED) {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'characters', true);
return;
}
$View = new View();
new ControllerHelper($View, 'page-staff');
foreach ($_SESSION['habbo'] as $Key => $Value) {
$View->set(array('habbo_' . $Key => $Value));
}
$View->set(array('page-title' => $this->Manhattan->Config['Site']['Title'], 'page-tagline' => 'Staff', 'site_title' => $this->Manhattan->Config['Site']['Title'], 'users_online' => 0, 'query_count' => $this->Manhattan->GetModel()->_count, 'exec_time' => round(microtime(true) - $this->Manhattan->Start, 3)));
echo $View->output();
} else {
$this->Manhattan->GetRouter()->Direct($this->Manhattan, 'error');
}
}
示例13: __construct
private $controller;
public function __construct($controller, $model)
{
$this->controller = $controller;
$this->model = $model;
}
public function output()
{
return '<p><a href="main.php?action=clicked">' . $this->model->string . "</a></p>";
}
}
class Controller
{
private $model;
public function __construct($model)
{
$this->model = $model;
}
public function clicked()
{
$this->model->string = "Updated Data, thanks to MVC and PHP!";
}
}
$model = new Model();
$controller = new Controller($model);
$view = new View($controller, $model);
if (isset($_GET['action']) && !empty($_GET['action'])) {
$controller->{$_GET['action']}();
}
echo $view->output();
示例14: foreach
$tpl_sidenum = Option::get('tpl_sidenum');
foreach ($custom_widget as $key => $val) {
$custom_widget[$key] = array_map('htmlspecialchars', $val);
}
$customWgTitle = array();
foreach ($widgetTitle as $key => $val) {
if (preg_match("/^.*\\s\\((.*)\\)/", $val, $matchs)) {
$customWgTitle[$key] = $matchs[1];
} else {
$customWgTitle[$key] = $val;
}
}
include View::getView('header');
require_once View::getView('widgets');
include View::getView('footer');
View::output();
}
//修改组件设置
if ($action == 'setwg') {
$widgetTitle = Option::get('widget_title');
//当前所有组件标题
$widget = isset($_GET['wg']) ? $_GET['wg'] : '';
//要修改的组件
$wgTitle = isset($_POST['title']) ? $_POST['title'] : '';
//新组件名
preg_match("/^(.*)\\s\\(.*/", $widgetTitle[$widget], $matchs);
$realWgTitle = isset($matchs[1]) ? $matchs[1] : $widgetTitle[$widget];
$widgetTitle[$widget] = $realWgTitle != $wgTitle ? $realWgTitle . ' (' . $wgTitle . ')' : $realWgTitle;
$widgetTitle = addslashes(serialize($widgetTitle));
Option::updateOption('widget_title', $widgetTitle);
switch ($widget) {
示例15: ascMsg
function ascMsg($msg, $url = 'javascript:history.back(-1);')
{
if (isset($_GET['gid'])) {
define('TEMPLATE_PATH', EMLOG_ROOT . '/m/view/');
$url = BLOG_URL . 'm/?post=' . intval($_GET['gid']);
include View::getView('header');
include View::getView('msg');
include View::getView('footer');
View::output();
exit;
} else {
emMsg($msg, $url);
}
}