本文整理汇总了PHP中template函数的典型用法代码示例。如果您正苦于以下问题:PHP template函数的具体用法?PHP template怎么用?PHP template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:32,代码来源:News_Admin.php
示例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');
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:7,代码来源:other.mod.php
示例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();
}
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:29,代码来源:monitor.m.php
示例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');
}
开发者ID:quericy,项目名称:Tieba-Cloud-Sign,代码行数:39,代码来源:ui.php
示例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);
}
开发者ID:bdemirel,项目名称:worksheet,代码行数:7,代码来源:index.php
示例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();
}
}
}
开发者ID:realityking,项目名称:rsgallery2,代码行数:34,代码来源:instance.class.php
示例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');
}
开发者ID:zhangzhengyu,项目名称:ThinkSAAS,代码行数:25,代码来源:action.feed.php
示例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;
}
开发者ID:WSKINGS,项目名称:chat_tickets,代码行数:7,代码来源:common.php
示例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));
}
开发者ID:NazarK,项目名称:sqp,代码行数:35,代码来源:form_email.php
示例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');
}
开发者ID:hubs,项目名称:yuncms,代码行数:26,代码来源:Spend_listController.php
示例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');
}
}
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:26,代码来源:class.DistrictController.php
示例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);
}
}
开发者ID:eappl,项目名称:prototype,代码行数:30,代码来源:qtype.php
示例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');
}
开发者ID:source-hunter,项目名称:tipask,代码行数:25,代码来源:doing.php
示例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();
}
开发者ID:NikoVonLas,项目名称:RaptorGameEngine,代码行数:32,代码来源:index.php
示例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');
}
}
开发者ID:hubs,项目名称:yuncms,代码行数:36,代码来源:IndexController.php
示例16: usesubmit
function usesubmit()
{
global $_G;
$list = $uids = array();
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$limit = $num + 20;
$giftMagicID = C::t('common_magic')->fetch_by_identifier('gift');
$mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0;
if ($mid) {
foreach (C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) {
$uids[] = intval($value['uid']);
}
}
if ($uids) {
$counter = 0;
$members = C::t('common_member')->fetch_all($uids);
foreach (C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) {
$value = array_merge($members[$uid], $value);
$info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
$value['avatar'] = addcslashes(avatar($uid, 'small'), "'");
$list[$uid] = $value;
$counter++;
if ($counter >= $num) {
break;
}
}
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_detector');
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:34,代码来源:magic_detector.php
示例17: Main
function Main()
{
global $attach_list, $_J;
$pagenum = 10;
$listcpattach = $this->Config['company_enable'] && $_J['member']['companyid'] > 0 ? true : false;
if ($_GET['code'] == 'myattach') {
$where = "AND uid = '" . MEMBER_ID . "'";
} elseif ($_GET['code'] == 'myfollowattach') {
$buddyids = get_buddyids(MEMBER_ID, $this->Config['topic_myhome_time_limit']);
if ($buddyids) {
$where = "AND item<>'company' AND uid IN(" . implode(',', $buddyids) . ")";
} else {
$where = "AND uid = 0";
}
} elseif ($listcpattach && $_GET['code'] == 'company') {
$where = "AND item='company' AND itemid='" . $_J['member']['companyid'] . "'";
$current_cp = 'current';
} else {
$where = "AND item<>'company'";
$current_new = 'current';
}
$attach = $this->AttachLogic->attachs_list($pagenum, $where);
$attach_list = $attach['list'];
if ($attach['page']) {
$page_arr = $attach['page'];
}
$hot_down_list = $this->AttachLogic->down_hot_attach();
$this->Title = '附件文档';
include template("attach");
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:30,代码来源:attach.mod.php
示例18: output
function output()
{
global $main, $vars;
$main->menu->hide = true;
$this->tpl['gmap_key_ok'] = include_gmap("?page=gmap&subpage=js&node=" . get('node'));
return template($this->tpl, __FILE__);
}
开发者ID:codeministry,项目名称:wind-ng-mc,代码行数:7,代码来源:gmap_fullmap.php
示例19: message
function message($msg, $redirect = '', $type = '')
{
global $_W;
if ($redirect == 'refresh') {
$redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'];
} elseif (!empty($redirect) && !strexists($redirect, 'http://')) {
$urls = parse_url($redirect);
$redirect = $_W['siteroot'] . 'app/index.php?' . $urls['query'];
}
if ($redirect == '') {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'info';
} else {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'success';
}
if ($_W['isajax'] || $type == 'ajax') {
$vars = array();
$vars['message'] = $msg;
$vars['redirect'] = $redirect;
$vars['type'] = $type;
exit(json_encode($vars));
}
if (empty($msg) && !empty($redirect)) {
header('location: ' . $redirect);
}
$label = $type;
if ($type == 'error') {
$label = 'danger';
}
if ($type == 'ajax' || $type == 'sql') {
$label = 'warning';
}
include template('common/message', TEMPLATE_INCLUDEPATH);
exit;
}
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:34,代码来源:common.func.php
示例20: usesubmit
function usesubmit()
{
global $_G;
$config = urlencode(getsiteurl() . 'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
$src = IMGDIR . "/doodle.swf?fid={$_G[gp_handlekey]}&oid={$_G[gp_mtarget]}&from={$_G[gp_from]}&config={$config}";
include template('home/magic_doodle');
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:7,代码来源:magic_doodle.php
注:本文中的template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论