本文整理汇总了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');