本文整理汇总了PHP中Template::loadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::loadFile方法的具体用法?PHP Template::loadFile怎么用?PHP Template::loadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::loadFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build()
{
try {
if (!file_exists($this->_path . "widget.php")) {
throw new Exception("Widget not found");
}
$widget = new Template($this->_path);
$widget->loadFile("widget.php");
$tpl = new Template(PATH_CMS . "templates/");
$tpl->content = $widget->buildVar();
$tpl->loadFile("widget.tpl.php");
return $tpl->buildVar();
} catch (Exception $e) {
echo _t($e->getMessage());
}
}
示例2: build
public function build()
{
$pref = new Pref("system");
$this->setMainTemplate($pref->template);
$tpl = new Template(PATH_TEMPLATES);
if (!USER_ID && !$this->isAllowed()) {
header("location: " . page("user", "login"));
}
if (!USER_ID && $this->isAllowed()) {
$tpl->login = true;
} else {
$tpl->login = false;
}
$tpl->loadFile("template.php");
$tpl->data = $this->data;
$tpl->build();
}
示例3: page
}
$this->setSidebar(true);
$this->menu["System"] = page("admin", "settings", "system");
$this->menu["Time"] = page("admin", "settings", "time");
$this->menu["Members"] = page("admin", "settings", "members");
$this->menu["Cleanup"] = page("admin", "settings", "cleanup");
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("z")) {
throw new Exception("Access denied");
}
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/settings/");
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
switch ($action) {
default:
$tpl->loadFile("system.php");
$this->setTitle("System Settings");
break;
case 'time':
$tpl->loadFile("time.php");
$this->setTitle("Time Settings");
break;
case 'members':
$tpl->loadFile("members.php");
$this->setTitle("Members Settings");
break;
case 'cleanup':
$tpl->loadFile("cleanup.php");
$this->setTitle("Cleanup Settings");
break;
}
示例4: die
<?php
/**
* Copyright 2012, openTracker. (http://opentracker.nu)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @link http://opentracker.nu openTracker Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @author Wuild
* @package openTracker
*/
if (!defined("INCLUDED")) {
die("Access denied");
}
$this->setTitle("Admin - mySQL");
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("z")) {
throw new Exception("Access denied");
}
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/mysql/");
$tpl->loadFile("query.php");
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
示例5: die
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @link http://opentracker.nu openTracker Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @author Wuild
* @package openTracker
*/
if (!defined("INCLUDED")) {
die("Access denied");
}
$this->setTitle("Torrent Details");
try {
if (!isset($_GET['id'])) {
throw new Exception("missing id");
}
if (!intval($_GET['id'])) {
throw new Exception("invalid id");
}
$db = new DB("torrents_imdb");
$db->select("imdb_torrent = '" . $db->escape($_GET['id']) . "'");
$tpl = new Template(PATH_APPLICATIONS . "torrent/tpl/");
if ($db->numRows()) {
$tpl->loadFile("details_imdb.php");
} else {
$tpl->loadFile("details.php");
}
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
示例6: sendEmail
/**
* Send an email with the noreply_email setting in the pref
*
* @param string $to The address to send the email to
* @param string $subject The subject of the email
* @param string $body The body of the email
*
* @return boolean $mail
*/
function sendEmail($to, $subject, $body)
{
$pref = new Pref("website");
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: " . $pref->noreply_email . "\r\n";
$tpl = new Template(PATH_CMS . "templates/");
$tpl->content = $body;
$tpl->loadFile("email.tpl.php");
$body = $tpl->buildVar();
$mail = mail($to, $subject, $body, $headers);
if ($mail) {
return $mail;
} else {
die("could not send email");
}
}
示例7: Acl
/**
* Copyright 2012, openTracker. (http://opentracker.nu)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @link http://opentracker.nu openTracker Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @author Wuild
* @package openTracker
*/
$acl = new Acl(USER_ID);
$wpref = new Pref("website");
$control = new Template(PATH_APPLICATIONS . $this->data['url']['application'] . "/");
$control->loadFile($this->data['url']['action'] . ".php");
$control->args = $this->data;
$content = $control->buildVar();
$title = $control->title != "" ? " - " . $control->title : "";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<?php
echo CMS_URL;
?>
" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title><?php
示例8: Acl
<?php
$this->setTitle("Admin - Settings");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("z")) {
throw new Exception("Access denied");
}
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/settings/");
$tpl->loadFile("main.php");
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
示例9: Acl
$this->setTitle("Admin - Forum");
$this->addJavascript("sortable.js");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("x")) {
throw new Exception("Access denied");
}
$this->menu["Forums"] = page("admin", "forum");
$this->menu["Create forum category"] = page("admin", "forum", "create-category");
$this->menu["Create forum"] = page("admin", "forum", "create-forum");
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/forum/");
switch ($action) {
default:
$tpl->loadFile("main.php");
break;
case 'create-forum':
$tpl->loadFile("create-forum.php");
break;
case 'edit-forum':
$tpl->loadFile("edit-forum.php");
break;
case 'create-category':
$tpl->loadFile("create-category.php");
break;
case 'edit-category':
$tpl->loadFile("edit-category.php");
break;
case 'delete-forum':
$tpl->loadFile("delete-forum.php");
示例10: Acl
$uid = $_GET['uid'];
$acl = new Acl($uid);
echo "<h4>" . _t("Conversation with") . " " . $acl->name . "</h4>";
$tpl = new Template(PATH_APPLICATIONS . "profile/tpl/");
$tpl->uid = $uid;
$tpl->loadFile("convo_reply.php");
$tpl->build();
$db = new DB("messages");
$db->setColPrefix("message_");
$db->setSort("message_added DESC");
$db->select("message_sender = '" . USER_ID . "' AND message_receiver = '" . $uid . "' OR message_sender = '" . $uid . "' AND message_receiver = '" . USER_ID . "'");
if ($db->numRows()) {
while ($db->nextRecord()) {
$tpl = new Template(PATH_APPLICATIONS . "profile/tpl/");
$tpl->item = $db->id;
$tpl->loadFile("convo_item.php");
$tpl->build();
}
$db = new DB("messages");
$db->message_unread = "no";
$db->update("message_sender = '" . $uid . "' AND message_receiver = '" . USER_ID . "'");
} else {
echo _t("No messages in this conversation yet.");
}
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
break;
}
?>
</div>
示例11: page
echo page("forums", "delete-post", "", "", "", "id=" . $db->post_id . "&confirm");
?>
">
<span class="btn red">Delete</span>
</a>
<?php
}
?>
<a href="<?php
echo page("forums", "quote-post", "", "", "", "post=" . $db->post_id);
?>
">
<span class="btn">Quote</span>
</a>
</td>
</tr>
</tbody>
</table>
<br />
<?php
}
echo $pagemenu;
$tpl = new Template(PATH_APPLICATIONS . "forums/tpl/");
$tpl->loadFile("reply.php");
$tpl->topic_id = $id;
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
示例12: die
*/
if (!defined("INCLUDED")) {
die("Access denied");
}
$this->setTitle("Admin - Support");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("x")) {
throw new Exception("Access denied");
}
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/support/");
switch ($action) {
default:
$tpl->loadFile("main.php");
break;
case 'view':
$tpl->loadFile("view.php");
break;
case 'delete':
$tpl->loadFile("delete.php");
break;
}
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
?>
示例13: Acl
}
$this->setTitle("Admin - Widgets");
$this->addJavascript("sortable.js");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("x")) {
throw new Exception("Access denied");
}
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
$this->menu["Widgets"] = page("admin", "widgets");
$this->menu["Install Widget"] = page("admin", "widgets", "install");
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/widgets/");
switch ($action) {
default:
$tpl->loadFile("main.php");
break;
case 'edit':
$tpl->id = isset($_GET['id']) ? $_GET['id'] : false;
$tpl->loadFile("edit.php");
break;
case 'delete':
$tpl->loadFile("delete.php");
break;
case 'install':
$tpl->loadFile("install.php");
break;
}
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
示例14: Acl
<?php
$this->setTitle("Admin - Members");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("x")) {
throw new Exception("Access denied");
}
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/members/");
switch ($action) {
default:
$tpl->loadFile("main.php");
break;
case 'edit':
$tpl->userid = getID($this->args['var_b']) ? getID($this->args['var_b']) : 0;
$tpl->loadFile("edit.php");
break;
case 'log':
$tpl->userid = getID($this->args['var_b']) ? getID($this->args['var_b']) : 0;
$tpl->loadFile("log.php");
break;
case 'create':
$tpl->loadFile("create.php");
break;
}
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
示例15: Acl
<?php
$this->setTitle("Admin - News");
$this->setSidebar(true);
try {
$acl = new Acl(USER_ID);
if (!$acl->Access("x")) {
throw new Exception("Access denied");
}
$action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
$tpl = new Template(PATH_APPLICATIONS . "admin/tpl/news/");
switch ($action) {
default:
$tpl->loadFile("main.php");
break;
case 'edit':
$tpl->loadFile("edit.php");
break;
case 'delete':
$tpl->loadFile("delete.php");
break;
case 'compose':
$tpl->loadFile("compose.php");
break;
}
$tpl->build();
} catch (Exception $e) {
echo error(_t($e->getMessage()));
}
?>