本文整理匯總了PHP中Templates::assignVars方法的典型用法代碼示例。如果您正苦於以下問題:PHP Templates::assignVars方法的具體用法?PHP Templates::assignVars怎麽用?PHP Templates::assignVars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Templates
的用法示例。
在下文中一共展示了Templates::assignVars方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Database
// Classes
require LIB . 'base/InfoMessage.php';
require LIB . 'base/AdminInfoMessage.php';
require LIB . 'themes/scss/scss.inc.php';
// Auto-Loader
require LIB . 'common/ClassLoader.php';
// Connect to database
$db = new Database($DBCRED['host'], $DBCRED['username'], $DBCRED['password'], $DBCRED['database']);
// Unset $DBCRED for security reasons
unset($DBCRED);
$userManager = new UserManager();
$user = $userManager->getUser();
// Tokens
$token = new Token();
$token->_('user.php', 'GET', RANK_USER);
$token->_('viewforum.php', 'GET', RANK_USER);
$token->_('viewtopic.php', 'GET', RANK_USER);
if (isset($disableTokenHere) && is_array($disableTokenHere)) {
foreach ($disableTokenHere as $ex) {
$token->_($ex, 'GET, POST', RANK_USER);
$token->_($ex, 'GET, POST', RANK_ADMIN);
}
}
// Plugins
$activePlugins = array();
PluginHelper::loadActivePlugins();
PluginHelper::delegate('__onCreate', array($db, $user));
Templates::init();
Templates::assignVars(array('pageTitle' => Config::get('page_title')));
$token->check('POST', $_POST);
$token->check('GET', $_GET);
示例2: Templates
<?php
require "../../templates.class.php";
$template = new Templates("tpl/");
$template->assignVars(array("POS" => "Position", "COLOR" => "red"));
for ($i = 0; $i < 5; $i++) {
$template->assignBlockVars("tr", array("COLOR" => $i % 2 == 0));
for ($j = 0; $j < 5; $j++) {
$template->assignBlockVars("tr.td", array("VAL" => 'x:' . $i . ';y:' . $j));
}
}
$template->setTemplate("index.html");
示例3: max
<?php
require 'base.php';
require LANGS . 'ForumT.php';
ForumT::init();
$topic = ForumTopic::fromID((int) $_GET['id']);
if (!$topic instanceof ForumTopic) {
echo ErrorMessage::setText(ForumT::get('topic_doesnt_exist'), true);
}
$forum = $topic->getForum();
$posts = $topic->getPosts(Config::get('max_posts_perpage'), max((int) $_GET['page'], 1));
Templates::assignVars(array('forum' => $forum, 'topic' => $topic, 'posts' => $posts['posts'], 'pages' => $posts['pages']));
PluginHelper::delegate('__onPageDisplay', array($page));
Templates::display('viewtopic');
示例4: array
<?php
require 'base.php';
require LANGS . 'ForumT.php';
ForumT::init();
$forum = Forum::fromID((int) $_GET['id']);
if (!$forum instanceof Forum) {
echo ErrorMessage::setText(ForumT::get('forum_doesnt_exist'), true);
}
$topics = $forum->getTopics();
Templates::assignVars(array('forum' => $forum, 'topics' => $topics['topics'], 'topics_pages' => $topics['pages']));
PluginHelper::delegate('__onPageDisplay', array($page));
Templates::display('viewforum');