本文整理汇总了PHP中view::compile方法的典型用法代码示例。如果您正苦于以下问题:PHP view::compile方法的具体用法?PHP view::compile怎么用?PHP view::compile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view::compile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simple
static function simple($firstPage, $currentPage, $lastPage)
{
// setup registry
$reg = new registry();
$reg['first'] = $firstPage;
$reg['previous'] = $currentPage <= $firstPage ? $firstPage : $currentPage - 1;
$reg['next'] = $currentPage >= $lastPage ? $lastPage : $currentPage + 1;
$reg['last'] = $lastPage;
// look for project view file
$srcView = sprintf('%s/pagerSimple.phtml', VIEW);
// if fail, fallback to mwa version
if (!file_exists($srcView)) {
$srcView = sprintf('%s/view/pagerSimple.phtml', LIBRARY);
}
// if fallback not found, throw error.
if (!file_exists($srcView)) {
throw new Exception('the given file ' . $srcView . ' was not found.');
}
// init and exec view
$view = new view($srcView);
return $view->compile($reg);
}
示例2: view
<?php
/**
* fotoalbum.php
*
* photoalbum admin page
* @author Anders Ytterström <anders.ytterstrom@gmail.com>
* @since 2007-12-29
*/
require '../../../init.php';
if (!isset($_POST['delete'])) {
http_response::redir('/admin/fotoalbum');
}
$registry =& registry::getInstance();
$user =& user::getInstance();
$view = new view(ROOT . '/view/admin/photos/delete.phtml');
$model = new model_photos();
if (!$user->isOnline()) {
http_response::redir('/login.php');
}
$registry['sidebar'] = false;
$registry['delete'] = $_POST['delete'];
echo $view->compile();
示例3: Exception
<?php
$user = user::getInstance();
$registry = registry::getInstance();
// validate model and construct if correct.
$registry['modelLabel'] = http_request::getString('model');
if ($registry['modelLabel'] == false || !file_exists(ROOT . '/model/' . $registry['modelLabel'] . ".php")) {
throw new Exception("the model <b>" . $registry['modelLabel'] . "</b> does not exist in this application. It could have been removed, or has ever existed. Check the spelling and try again.");
}
$qryModel = "model_" . $registry['modelLabel'];
$model = new $qryModel();
// needed for the page header.
admin::getModels();
$registry['controls'] = $model->getEntityProperties();
// setup page
$registry['entities'] = $model->getSummary();
$registry['title'] = $registry['modelLabel'];
$registry['bclass'] = $registry['modelLabel'] . " list model";
//see if there is any custom template. Else,fall back on default.
$ct = sprintf("%s/view/cms/list/%s.phtml", ROOT, $registry['modelLabel']);
if (!file_exists($ct)) {
$ct = sprintf("%s/list/%s.phtml", VIEW, $registry['modelLabel']);
}
if (file_exists($ct)) {
$view = new view($ct);
$view->isFragment();
$registry['customList'] = $view->compile();
}
示例4: generate
static function generate()
{
$form = new view(SITE . '/view/form/normal.phtml');
$form->isFragment = true;
return $form->compile();
}