本文整理汇总了PHP中TemplatePower::showUnAssigned方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplatePower::showUnAssigned方法的具体用法?PHP TemplatePower::showUnAssigned怎么用?PHP TemplatePower::showUnAssigned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplatePower
的用法示例。
在下文中一共展示了TemplatePower::showUnAssigned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TemplatePower
<?php
require_once 'config.inc.php';
$tpl_main = new TemplatePower('template/master.html');
$tpl_main->prepare();
// see if the login form was submitted
if (isset($_POST['login'])) {
$user = stripslashes($_POST['username']);
$pass = stripslashes($_POST['password']);
$goto = $_POST['redirect'];
if ($_AUTH->login($user, $pass)) {
include_once $goto;
die;
} else {
$tpl = new TemplatePower('template/error.html');
$tpl->assignGlobal('error_message', 'Invalid username / password.' . $user);
}
// display the default login form
} else {
$tpl = new TemplatePower('template/login.html');
$tpl->assignGlobal('redirect', $_GET['redirect']);
}
$tpl->prepare();
$tpl->showUnAssigned(false);
$tpl_main->assign('content', $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
示例2: get_user_courses
// pull the template together
$tpl->prepare();
// display the selected course
if (isset($course)) {
$c = get_user_courses($_DB);
$course = $c[0]['courseID'];
set_course_template($_DB, $tpl, $course);
}
// add the remaining components to the template
$tpl->assignGlobal('course_select_box', gen_course_select_box($_DB));
$tpl->assignGlobal('username', $_SESSION['userName']);
}
// for all of the pages, put the content into the main template
$tpl->showUnAssigned(false);
$tpl_main->assignGlobal("content", $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
/**
* Return a list of courses that the user is enrolled in
*
* @db the MySQL database connection
*
**/
function get_user_courses($db)
{
$user = $_SESSION['userID'];
$db->sql_query("SELECT * FROM courses WHERE courseID = ( SELECT course FROM studentstocourses WHERE student = '{$user}' ) ");
return $db->sql_fetchrowset();
}
/**
* Return a HTML combo box populated with the courses that the user is in