本文整理汇总了PHP中template函数的典型用法代码示例。如果您正苦于以下问题:PHP template函数的具体用法?PHP template怎么用?PHP template使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* @abstract Displays and processes the edit news form
* @param integer $id
* @access public
*/
public function edit($id = false)
{
if (!files()->setUploadDirectory()) {
sml()->say("The file upload directory does not appear to be writable. Please create the folder and set proper permissions.");
}
$form = new Form('news', $id);
if (!$id) {
$form->setCurrentValue('timestamp', date("Y-m-d H:i:s"));
}
// if form has been submitted
if ($form->isSubmitted()) {
$file = files()->upload('pdf_filename');
if (is_array($file) && !empty($file[0])) {
$form->setCurrentValue('pdf_filename', $file[0]['file_name']);
}
if ($form->save($id)) {
sml()->say('News entry has successfully been updated.');
router()->redirect('view');
}
}
// make sure the template has access to all current values
$data['form'] = $form;
template()->addCss('admin/datepicker.css');
template()->addJs('admin/datepicker.js');
template()->addJs('edit.js');
template()->display($data);
}
示例2: Introduce
function Introduce()
{
$http_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$is_android = false === strpos($http_user_agent, 'android') ? false : true;
$is_iphone = false === strpos($http_user_agent, 'iphone') ? false : true;
include template('wap_introduce');
}
示例3: index
function index()
{
global $body;
global $navigation;
$body = <<<EOD
\t{$navigation}
\t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;">
\t\t<h2>Monitor</h2>
\t\t<h3>See what users are typing in real-time on your site</h3>
\t\t<div>
\t\t\t<div id="centernav" style="width:700px">
\t\t\t\t<script>
\t\t\t\t\tjQuery(document).ready(function () {
\t\t\t\t\t\tjQuery.cometchatspy();\t
\t\t\t\t\t});
\t\t\t\t</script>
\t\t\t\t<div id="data"></div>
\t\t\t</div>
\t\t</div>
\t\t<div style="clear:both;padding:7.5px;"></div>
\t</div>
\t<div style="clear:both"></div>
EOD;
template();
}
示例4: loadhead
/**
* 加载头部
* @param string $title 页面标题
*/
function loadhead($title = '')
{
if (defined('SYSTEM_NO_UI')) {
return;
}
$title = empty($title) ? strip_tags(SYSTEM_NAME) : $title . ' - ' . strip_tags(SYSTEM_NAME);
doAction('top');
echo '<!DOCTYPE html><html><head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
echo '<meta http-equiv="charset" content="utf-8">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
echo '<title>' . $title . '</title>';
echo '<meta name="generator" content="Tieba Cloud Sign Ver.' . SYSTEM_VER . '" />';
echo '<link href="favicon.ico" rel="shortcut icon"/>';
echo '<meta name="author" content="Kenvix (http://zhizhe8.net) at StusGame GROUP (http://www.stus8.com)" />';
echo '<link rel="canonical" href="http://www.stus8.com" />';
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />';
echo '<script src="source/js/jquery.min.js"></script>';
echo '<link rel="stylesheet" href="source/css/bootstrap.min.css">';
echo '<script src="source/js/bootstrap.min.js"></script>';
echo '<style type="text/css">body { font-family:"微软雅黑","Microsoft YaHei";background: #eee; }</style>';
echo '<script type="text/javascript" src="source/js/js.js"></script>';
echo '<link rel="stylesheet" href="source/css/ui.css">';
echo '<link rel="stylesheet" href="source/css/my.css">';
echo '<script type="text/javascript" src="source/js/my.js"></script>';
echo '<meta name="keywords" content="' . option::get('system_keywords') . '" />';
echo '<meta name="description" content="' . option::get('system_description') . '" />';
doAction('header');
echo '</head><body>';
if (option::get('trigger') == 1) {
echo "<script>\$.ajax({ async:true, url: '" . SYSTEM_URL . "do.php', type: 'GET', data : {},dataType: 'HTML'});</script>";
}
template('navi');
doAction('body');
}
示例5: html
function html($rows = null)
{
$style = "\n <style>\n .qbuttons\n {\n background-color: hsl(217, 90%, 55%);\n color: white;\n border: none;\n border-radius: 3px;\n padding: 2px 5px;\n font-size: 1.1em;\n font-weight: bold;\n position: relative;\n align: right;\n top: 25%;\n margin: 0 5px;\n }\n #worksheets\n {\n background-color: hsl(217, 90%, 55%);\n color: white;\n border: none;\n border-radius: 3px;\n padding: 2px 5px;\n font-size: 1.1em;\n font-weight: bold;\n position: relative;\n top: 25%;\n }\n nav\n {\n text-align: justify;\n }\n nav:after\n {\n content: '';\n display: inline-block;\n width: 100%;\n height: 0;\n font-size:0;\n line-height:0;\n }\n div\n {\n display: inline-block;\n }\n #gotop\n {\n appearance: button;\n -moz-appearance: button;\n -webkit-appearance: button;\n text-decoration: none;\n font: menu;\n color: ButtonText;\n display: inline-block;\n padding: 0px 6px;\n background-color: white;\n color: hsl(217, 90%, 55%);\n border: none;\n border-radius: 3px;\n height: 50%;\n width: 8%;\n font-size: 1.1em;\n font-weight: bold;\n /*position: relative;\n left: 3%;\n top: 25%;*/\n }\n </style>\n ";
$addition = "\n <a id='gotop' href='#top'>Go To Top</a>";
$html = "\n <form method='post'>\n <nav>\n <div id='top'>\n <button type='button' id='worksheets' onclick='window.location.href=\"wslist.php\"'>Go To Worksheets</button>\n </div>\n <div>\n <input class='qbuttons' type='submit' name='add' value='Add'>\n <input class='qbuttons' type='submit' name='edit' value='Edit Selected'>\n <input class='qbuttons' type='submit' name='prepare' value='Prepare'>\n </div>\n </nav>\n <br>\n <table>\n <thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>\n \t Select\n \t </th>\n \t <th>\n \t Question\n \t </th>\n \t <th>\n \t Topic\n \t </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n <tbody>\n {$rows}\n </tbody>\n </table>\n </form>";
template($html, $style, 1, $addition);
}
示例6: mainSwitch
/**
* This is the main task switch where we decide what to do.
*/
function mainSwitch()
{
switch (rsgInstance::getVar('rsgOption', '')) {
case 'rsgComments':
require_once JPATH_RSGALLERY2_SITE . '/lib/rsgcomments/rsgcomments.php';
break;
case 'rsgVoting':
require_once JPATH_RSGALLERY2_SITE . '/lib/rsgvoting/rsgvoting.php';
break;
case 'myGalleries':
require_once JPATH_RSGALLERY2_SITE . '/lib/mygalleries/mygalleries.php';
break;
case 'search':
require_once JPATH_RSGALLERY2_SITE . '/lib/rsgsearch/search.php';
break;
default:
switch (rsgInstance::getVar('task', '')) {
case 'xml':
xmlFile();
break;
case "downloadfile":
downloadFile();
break;
default:
// require the base class rsgDisplay
require_once JPATH_RSGALLERY2_SITE . '/templates/meta/display.class.php';
// show the template
template();
}
}
}
示例7: index
public function index()
{
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsurl('feed', 'index', array('page' => ''));
$lstart = $page * 20 - 20;
$arrFeeds = $this->findAll('feed', null, 'addtime desc', null, $lstart . ',20');
$feedNum = $this->findCount("feed");
$pageUrl = pagination($feedNum, 20, $page, $url);
if ($page > 1) {
$title = '社区动态 - 第' . $page . '页';
} else {
$title = '社区动态';
}
foreach ($arrFeeds as $key => $item) {
$data = json_decode($item['data'], true);
if (is_array($data)) {
foreach ($data as $key => $itemTmp) {
$tmpkey = '{' . $key . '}';
$tmpdata[$tmpkey] = stripslashes(urldecode($itemTmp));
}
}
$arrFeed[] = array('user' => aac('user')->getOneUser($item['userid']), 'content' => strtr($item['template'], $tmpdata), 'addtime' => $item['addtime']);
}
include template('index');
}
示例8: end_exit
function end_exit($content, $url = 'javascript:history.go(-1);', $t = 2)
{
$temp = template('exit.html');
$temp->assign(array('content' => $content, 'url' => $url, 'time' => $t));
$temp->display();
die;
}
示例9: frm
function frm($name)
{
if (form_post("submit")) {
$message = "";
foreach ($_REQUEST as $key => $value) {
if (str_beg($key, "cb_")) {
$message .= "{$value}\r\n";
}
if (str_beg($key, "f_")) {
$caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
$message .= "{$caption}:\r\n{$value}\r\n\r\n";
}
}
$from = "no-reply-site-form@" . $_SERVER['HTTP_HOST'];
$to = setting("admin_email");
$subject = form_post("subject");
$local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
if (form_file_uploaded("uploadedfile")) {
$tmp = $_FILES['uploadedfile']['tmp_name'];
$fname = $_FILES['uploadedfile']['name'];
/* if($local) {
die("<pre>$message tmp[$tmp] fname[$fname]</pre>");
} else {*/
mail_attach($from, $to, $subject, $message, $tmp, $fname);
// }
} else {
/* if($local) {
die("<pre>$message</pre>");
} else*/
mail_from($to, $subject, $message, $from);
}
return form_post("success");
}
return template("form_email", "content", template("form_email_" . $name));
}
示例10: init
public function init()
{
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
$userid = cookie('_userid');
$where = array('userid' => $userid);
if (isset($_GET['dosubmit'])) {
$type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : '';
$endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : '';
$starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : '';
if (!empty($starttime) && empty($endtime)) {
$endtime = TIME;
}
if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) {
showmessage(L('wrong_time_over_time_to_time_less_than'));
}
if (!empty($starttime)) {
$where['creat_at'] = array('between', $starttime . ',' . $endtime);
}
if (!empty($type)) {
$where['type'] = $type;
}
}
$list = $this->spend_db->where($where)->order('id desc')->listinfo($page);
$pages = $this->spend_db->pages;
include template('pay', 'spend_list');
}
示例11: index
public function index()
{
if ($this->checkFormSubmit()) {
$this->save();
} else {
global $G;
$province = intval($_GET['province']);
$city = intval($_GET['city']);
$county = intval($_GET['county']);
$districtlist = $provincelist = $citylist = $countylist = array();
$provincelist = $this->t('district')->where(array('fid' => 0))->select();
$districtlist = $provincelist;
if ($province) {
$citylist = $this->t('district')->where(array('fid' => $province))->select();
$districtlist = $citylist;
}
if ($city) {
$countylist = $this->t('district')->where(array('fid' => $city))->select();
$districtlist = $countylist;
}
if ($county) {
$districtlist = $this->t('district')->where(array('fid' => $county))->select();
}
include template('district');
}
}
示例12: onqtype
function onqtype($msg = '', $ty = '')
{
$hasIntoQtypePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoQtype");
// 是否有进入操作员管理页面权限
if ($hasIntoQtypePrivilege['return']) {
if (isset($this->get[2])) {
$qtype_info = $_ENV['qtype']->GetQType(intval($this->get[2]));
$qtype_info['faq'] = unserialize($qtype_info['faq']);
$qtype_info['complain'] = unserialize($qtype_info['complain']);
$qtype_info['trading'] = unserialize($qtype_info['trading']);
}
$qtype_list = $_ENV['qtype']->GetAllQType(0, '', 0);
foreach ($qtype_list as $qtypeId => $qtypeInfo) {
if ($qtypeInfo['pid'] > 0) {
$qtype_list[$qtypeId]['parentName'] = $qtype_list[$qtypeInfo['pid']]['name'];
} else {
$qtype_list[$qtypeId]['parentName'] = "无分类";
}
$qtype_list[$qtypeId]['complain'] = unserialize($qtypeInfo['complain']);
$qtype_list[$qtypeId]['faq'] = unserialize($qtypeInfo['faq']);
$qtype_list[$qtypeId]['trading'] = unserialize($qtypeInfo['trading']);
}
$msg && ($message = $msg);
$ty && ($type = $ty);
include template('qtype', 'admin');
} else {
$hasIntoQtypePrivilege['url'] = "?admin_main";
__msg($hasIntoQtypePrivilege);
}
}
示例13: ondefault
function ondefault()
{
$navtitle = "问答动态";
$type = 'atentto';
$recivetype = $this->get[2];
if ($recivetype) {
$type = $recivetype;
}
if (!$this->user['uid']) {
$type = 'all';
}
$navtitletable = array('all' => '问答动态', 'my' => '我的动态', 'atentto' => '关注的动态');
$navtitle = $navtitletable[$type];
$page = max(1, intval($this->get[3]));
$pagesize = $this->setting['list_default'];
$startindex = ($page - 1) * $pagesize;
$doinglist = $_ENV['doing']->list_by_type($type, $this->user['uid'], $startindex, $pagesize);
$rownum = $_ENV['doing']->rownum_by_type($type, $this->user['uid']);
$departstr = page($rownum, $pagesize, $page, "doing/default/{$type}");
if ($type == 'atentto') {
$recommendsize = $rownum ? 3 : 6;
$recommandusers = $_ENV['doing']->recommend_user($recommendsize);
}
include template('doing');
}
示例14: actionIndex
function actionIndex()
{
if (isset($_SESSION['id'])) {
header("Location: /cabinet");
}
if (isset($_GET['result'])) {
switch (@$_GET['result']) {
case 'regerror':
echo "<script>alert('Введены неверные данные или аккаунт уже существует');</script>";
break;
case 'loginerror':
echo "<script>alert('Неверный логин или пароль');</script>";
break;
default:
break;
}
}
$main = new Templater();
$main->import("interface/index.tpl");
$main->setvar("%URL%", "http://" . $GLOBALS['url']);
$main->setvar("%LOGIN_URL%", "/index/login");
$main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
$main->setvar("%YEAR%", date("Y"));
$main->setvar("%CSS%", "<style>" . templater("css/main.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
$main->setvar("%REGISTER%", template("interface/register.tpl"));
$cursor = Database::Get("news", array('public' => 1))->sort(array('date' => -1))->limit(1)->getNext();
$newss = templater("interface/news.tpl", array("%SUBJECT%" => $cursor['title'], "%DATE%" => $cursor['date'], "%ANNOUNCE%" => $cursor['short'], "%LINK_MORE%" => "http://" . $GLOBALS['url'] . "/news/read?id=" . $cursor['_id'], "%ID%" => $cursor['_id']));
$main->setvar("%NEWS%", $newss);
$main->setvar("%GAME_TITLE%", $GLOBALS['name']);
$main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
$main->renderEcho();
}
示例15: register
/**
* 申请友情链接
*/
public function register()
{
if (isset($_POST['dosubmit'])) {
if ($_POST['name'] == "") {
showmessage(L('sitename_noempty'), U('link/index/register'));
}
if ($_POST['url'] == "") {
showmessage(L('siteurl_not_empty'), U('link/index/register'));
}
if (!in_array($_POST['linktype'], array('0', '1'))) {
$_POST['linktype'] = '0';
}
$link_db = Loader::model('link_model');
$_POST['logo'] = String::htmlspecialchars($_POST['logo']);
if ($_POST['linktype'] == '0') {
$sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url']);
} else {
$sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url'], 'logo' => $_POST['logo']);
}
$link_db->insert($sql);
showmessage(L('add_success'), U('link/index'));
} else {
$setting = S('common/link');
if (isset($setting['is_post']) && $setting['is_post'] == '0') {
showmessage(L('suspend_application'), HTTP_REFERER);
}
$this->type = Loader::model('type_model');
$types = $this->type->get_types();
// 获取站点下所有友情链接分类
$SEO = seo('', L('application_links'), '', '');
include template('link', 'register');
}
}