本文整理匯總了PHP中Templates::assign方法的典型用法代碼示例。如果您正苦於以下問題:PHP Templates::assign方法的具體用法?PHP Templates::assign怎麽用?PHP Templates::assign使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Templates
的用法示例。
在下文中一共展示了Templates::assign方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unset
// If custom page
if (substr($pageName, -4) == '.php') {
unset($_GET[$token->getTokenName()]);
unset($_POST[$token->getTokenName()]);
$pageCreators = PluginHelper::delegate('__onCreatePage', array(substr($pageName, 0, strlen($pageName) - 4), $_GET));
if (count($pageCreators) == 1) {
// Get single page creator
foreach ($pageCreators as $p) {
$pageCreator = $p;
}
// Does it implement PageCreator?
if (!$pageCreator instanceof PageCreator) {
Functions::log(Functions::LOG_ERROR, get_class($pageCreator) . ' does not implement interface PageCreator');
} else {
Templates::assign('pageTitle', $pageCreator->getTitle());
Templates::assign('customContent', $pageCreator->getContent());
Templates::display('custom');
}
exit;
} else {
if (count($pageCreators) > 1) {
// CLASH OF PLUGINS!!
$errorMessage = 'Page Creator conflict for page ' . $pageName . ':<br /><br /><ul>';
foreach ($pageCreators as $package => $pageCreator) {
$errorMessage .= '<b>' . $package . '</b>: ' . get_class($pageCreator);
}
$errorMessage .= '</ul>';
Functions::log(Functions::LOG_ERROR, $errorMessage);
exit;
}
}
示例2: array
<?php
require 'base.php';
$categories = ForumCategory::getAllCategories();
Templates::assign('categories', $categories);
PluginHelper::delegate('__onPageDisplay', array($page));
Templates::display('forums');
示例3:
<?php
include 'base.php';
$profileUser = UserReadOnly::fromID((int) $_GET['id']);
if (!$profileUser instanceof UserReadOnly) {
$errorMessage = 'User does not exist.';
echo ErrorMessage::setText($errorMessage, true);
} else {
Templates::assign('profileUser', $profileUser);
}
Templates::display('user');