本文整理汇总了PHP中Viewer::UseTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Viewer::UseTemplate方法的具体用法?PHP Viewer::UseTemplate怎么用?PHP Viewer::UseTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::UseTemplate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
if (User::FindUser($user_name)) {
$error_message = I18n::L("Username «%s» is already taken, please find another username.", array($user_name));
} else {
if (User::FindUserByEmail($user_email)) {
$error_message = I18n::L("This email «%s» is already regesitered, please use another email.", array($user_email));
} else {
$obj = User::Add(User::Create($user_name, $user_email, $_POST["user_password"]));
if ($obj->user_id) {
Session::StartUser($obj);
header("Location:" . PREFIX . "/dashboard/");
exit;
} else {
$error_message = I18n::L("Error while registring user.");
}
//todo: add some error log
}
}
}
}
} else {
if (!empty($_POST["register"])) {
$error_message = I18n::L("Please fill all required fields.");
}
}
Viewer::AddData("title", I18n::L("Title Registration"));
Viewer::AddData("error_message", $error_message);
Viewer::UseTemplate("register.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例2: elseif
Viewer::AddData("comments", Comments::GetByIdea($idea));
Viewer::AddData("idea", $idea);
Viewer::AddData("title", $idea->idea_title);
if (isset($_GET["rate_plus"])) {
$rated = 3;
} elseif (isset($_GET["rate_minus"])) {
$rated = 2;
} else {
$rated = 1;
}
if (User::Logged()) {
$rate = Rate::Find($idea, User::$current);
if (!empty($rate)) {
$rated = 4;
}
Viewer::AddData("rated", $rated);
}
Viewer::UseTemplate("idea.tpl");
$action = "idea";
}
}
} else {
Viewer::Restricted();
$action = "idea";
}
if (!$action) {
Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例3: header
$user->user_email = "";
$user->user_name = $user->user_name . "_removed";
if (!User::Update($user)) {
$error_message = I18n::L("Cannot update user.");
$user = User::GetById($id);
} else {
header("Location:" . PREFIX . "/profile?" . $user->user_id);
exit;
}
} else {
header("Location:" . PREFIX . "/profile?" . $user->user_id);
exit;
}
}
Viewer::AddData("user", $user);
Viewer::AddData("title", I18n::L("Title %s's profile", array($user->user_name)));
Viewer::AddData("ideas_count", Ideas::GetByUser($user) ? sizeof(Ideas::GetByUser($user)) : 0);
Viewer::AddData("comments_count", Comments::GetByUser($user) ? sizeof(Comments::GetByUser($user)) : 0);
Viewer::UseTemplate("user_profile.tpl");
$action = "profile";
}
} else {
Viewer::Restricted();
$action = "profile";
}
if (!$action) {
Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例4: Restricted
/**
*
* @static
* return void
*/
public static function Restricted()
{
Viewer::AddData("title", "Restricted");
Viewer::UseTemplate("unregistered.tpl");
}
示例5: ob_start
<?php
/**
* @package zoneideas
* @subpackage dashboard
* @author Serg Podtynnyi <serg.podtynnyi@gmail.com>
*/
/**
*
*
*/
ob_start();
include_once "../core.php";
$action = false;
if (User::Logged()) {
Viewer::AddData("ideas", Ideas::GetByUser(User::$current));
Viewer::AddData("user", User::$current);
Viewer::AddData("title", I18n::L("Title Dashboard"));
Viewer::UseTemplate("dashboard.tpl");
$action = "dashboard";
} else {
Viewer::Restricted();
$action = "restricted";
}
if (!$action) {
Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例6: ob_start
<?php
/**
* @package zoneideas
* @subpackage index
* @author Serg Podtynnyi <serg.podtynnyi@gmail.com>
*/
/**
*
*
*/
ob_start();
include "core.php";
Viewer::AddData("title", "Home");
Viewer::UseTemplate("front.tpl");
Viewer::Show();
ob_end_flush();
示例7: ob_start
/**
*
*
*/
ob_start();
include_once "../core.php";
$action = "login";
if (!empty($_POST["login"])) {
if (!empty($_POST["user_name"]) && !empty($_POST["user_password"])) {
$obj = User::CheckUser($_POST["user_name"], $_POST["user_password"]);
User::$current = Session::StartUser($obj);
} else {
$error_message = I18n::L("Please fill all required fields.");
}
}
if (User::Logged()) {
header("Location:" . PREFIX . "/dashboard/");
exit;
}
if (!empty($_POST["login"]) && !User::Logged()) {
if (empty($error_message)) {
$error_message = I18n::L("Wrong password.");
}
Viewer::AddData("error_message", $error_message);
Viewer::AddData("user_name", $_POST["user_name"]);
}
Viewer::AddData("title", I18n::L("Title Login"));
Viewer::UseTemplate("login.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();