本文整理汇总了PHP中Render::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::assign方法的具体用法?PHP Render::assign怎么用?PHP Render::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::assign方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$render = new Render();
$render->assign('update', true);
$render->display('head.tpl');
$items = new Items($this->db);
$list = $items->get_items();
$render->assign('items', $list);
$render->display('items.tpl');
$render->display('foot.tpl');
}
示例2: render
function render()
{
$render = new Render($this->db);
// Check our authorization
$auth = new Auth($this->db);
// If we've been posted a password and it's wrong
if (isset($_POST['user']) && isset($_POST['pass']) && !$auth->validate($_POST['user'], $_POST['pass'])) {
// TODO: Use a real error handler instead of this
header('HTTP/1.1 403 Forbidden');
$render->assign('title', 'There was an error');
$render->assign('reason', "I'm sorry, the password you entered is incorrect");
$render->display('auth_fail.tpl');
return;
}
// Otherwise we need to check to see if the user has already logged in or not
if (!$this->auth->check()) {
header('HTTP/1.1 403 Not Found');
$render->assign('title', 'There was an error');
$render->assign('reason', 'You need to login to perform this operation.');
$render->display('auth_fail.tpl');
return;
}
if (empty($_REQUEST['op'])) {
$op = 'main';
} else {
$op = $_REQUEST['op'];
}
if (method_exists($this, $op)) {
$this->{$op}($render);
} else {
header('HTTP/1.1 404 Not Found');
$render->assign('title', 'There was an error');
$render->assign('reason', 'The page you are looking for does not seem to exist.');
$render->display('auth_fail.tpl');
return;
}
}
示例3: render
function render()
{
$newest = $_REQUEST['newest'];
$items = $this->db->GetAll('SELECT lylina_items.id, lylina_items.url, lylina_items.title, lylina_items.body, UNIX_TIMESTAMP(lylina_items.dt) AS timestamp, lylina_items.viewed, lylina_feeds.url AS feed_url, lylina_feeds.name AS feed_name FROM lylina_items, lylina_feeds WHERE UNIX_TIMESTAMP(lylina_items.dt) > UNIX_TIMESTAMP()-(8*60*60) AND lylina_items.feed_id = lylina_feeds.id ORDER BY lylina_items.dt DESC');
foreach ($items as &$item) {
// If we have a newer item, mark it as new
if ($newest && $item['id'] > $newest) {
$item['new'] = 1;
}
print "\n";
// Format the date for headers
$item['date'] = date('l F j, Y', $item['timestamp']);
}
$render = new Render();
$render->assign('items', $items);
$render->display('items.tpl');
}
示例4: render
function render()
{
if (isset($_REQUEST['newest'])) {
$newest = $_REQUEST['newest'];
} else {
$newest = 0;
}
if (isset($_REQUEST['pivot'])) {
$pivot = $_REQUEST['pivot'];
} else {
$pivot = false;
}
$items = new Items($this->db);
$list = $items->get_items($newest, $pivot);
$render = new Render();
$render->assign('items', $list);
$render->display('items.tpl');
}
示例5: render
function render()
{
$newest = $_REQUEST['newest'];
$fetch = new Fetch($this->db);
$fetch->get();
$query = 'SELECT COUNT(*)
FROM lylina_items';
if ($this->auth->check()) {
$query .= ' INNER JOIN (lylina_userfeeds) ON (lylina_items.feed_id = lylina_userfeeds.feed_id)';
}
$query .= ' WHERE id > ? AND UNIX_TIMESTAMP(dt) > UNIX_TIMESTAMP()-(8*60*60)';
if ($this->auth->check()) {
$query .= ' AND lylina_userfeeds.user_id = ?';
}
$result = $this->db->GetRow($query, array($newest, $this->auth->getUserId()));
if ($result) {
$count = $result['COUNT(*)'];
} else {
$count = 0;
}
$render = new Render();
$render->assign('count', $count);
$render->display('update.tpl');
}