本文整理汇总了PHP中smarty函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty函数的具体用法?PHP smarty怎么用?PHP smarty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pieform_element_tags
/**
* Provides a tag input field
*
* @param Pieform $form The form to render the element for
* @param array $element The element to render
* @return string The HTML for the element
*/
function pieform_element_tags(Pieform $form, $element)
{
$smarty = smarty();
$value = array();
if (isset($element['defaultvalue']) && is_array($element['defaultvalue'])) {
$value = $element['defaultvalue'];
}
if ($form->get_value($element)) {
$value = $form->get_value($element);
}
if (isset($element['value']) && is_array($element['value'])) {
$value = $element['value'];
}
if (!is_array($value)) {
$value = array();
}
if (!isset($element['size'])) {
$element['size'] = 60;
}
$smarty->assign('name', $element['name']);
$smarty->assign('size', $element['size']);
$smarty->assign('id', $form->get_name() . '_' . $element['id']);
$smarty->assign('value', join(', ', $value));
$smarty->left_delimiter = '{{';
$smarty->right_delimiter = '}}';
return $smarty->fetch('form/tags.tpl');
}
示例2: index
function index()
{
//验证权限,跳转提示页面
if (!in_array(parent::visite_access, $this->admin_access)) {
http::skip('message/login/forbid');
}
//接收请求参数
$category = rq(2);
//类型(1,已读/0,未读/全部)
$page = rq(3, 1);
//页码
//获取删除和回复权限
$del_access = in_array(parent::del_access, $this->admin_access);
$reply_access = in_array(parent::reply_access, $this->admin_access);
//调用查询模型
$message = self::message_model($category, $page, 10);
//处理分页导航
$page_url = dc_url . 'manage/' . $category . '/';
$page_nav = s_page::mark($page_url, $message['info'][0], $page, 3);
//视图赋值
$tpl = smarty('admin');
$head['frame'] = '_self';
$head['title'] = '留言管理_EQPHP案例留言本';
$tpl->assign('head', $head);
$tpl->assign('del_access', $del_access);
$tpl->assign('reply_access', $reply_access);
$tpl->assign('rs_count', $message['num']);
$tpl->assign('message', $message['info'][1]);
$tpl->assign('page_nav', $page_nav);
//渲染视图模板
$tpl->display('message/manage');
}
示例3: pieform_element_authlist
/**
* Provides an email list, with verification to enable addresses
*
* @param array $element The element to render
* @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
function pieform_element_authlist(Pieform $form, $element)
{
$smarty = smarty();
$smarty->left_delimiter = '{{';
$smarty->right_delimiter = '}}';
$value = $form->get_value($element);
if (!is_array($value) && isset($element['defaultvalue']) && is_array($element['defaultvalue'])) {
$value = $element['defaultvalue'];
}
if (!isset($value['default'])) {
$value['default'] = '';
}
if (is_array($value) && count($value)) {
$smarty->assign('authtypes', $value['authtypes']);
$smarty->assign('instancelist', $value['instancelist']);
$smarty->assign('instancestring', implode(',', $value['instancearray']));
$smarty->assign('default', $value['default']);
$smarty->assign('institution', $value['institution']);
}
$smarty->assign('name', $element['name']);
$smarty->assign('cannotremove', json_encode(get_string('cannotremove', 'auth')));
$smarty->assign('cannotremoveinuse', json_encode(get_string('cannotremoveinuse', 'auth')));
$smarty->assign('saveinstitutiondetailsfirst', json_encode(get_string('saveinstitutiondetailsfirst', 'auth')));
$smarty->assign('noauthpluginconfigoptions', json_encode(get_string('noauthpluginconfigoptions', 'auth')));
return $smarty->fetch('form/authlist.tpl');
}
示例4: display
public function display($tpl = null)
{
if (is_null($tpl)) {
smarty()->display(strtolower(get_class($this)) . '.tpl');
} else {
smarty()->display($tpl);
}
}
示例5: generate_feed
function generate_feed($feed, $posts)
{
$smarty = smarty();
$smarty->assign('feed', $feed);
$smarty->assign('posts', $posts);
header("Content-Type: application/atom+xml");
$smarty->display('artefact:blog:atom.xml.tpl');
}
示例6: fetch
public function fetch()
{
$this->gabarit->process();
$this->process();
smarty()->assign('page', $this);
smarty()->assign($this->template_vars);
return smarty()->fetch(DIR_TPL . $this->name . '.tpl');
}
示例7: process
public function process()
{
$this->setRegles();
$this->addJs(WWW_JS . 'jquery.event.drag-2.0.min.js');
smarty()->assign('plateau_inverse', intval(slot()->position) == 1);
$demi = $this->taille_plateau / 2;
$nb_pion = $demi * ($demi - 1);
smarty()->assign($this->getArrayParam());
}
示例8: process
public function process()
{
$this->initRegles();
$this->initPlateau();
$this->addJs(WWW_JS . 'jquery.event.drag.min.js');
$demi = $this->regles->taille_plateau / 2;
$nb_pion = $demi * ($demi - 1);
smarty()->assign(array('plateau_inverse' => intval(slot()->position) == 1, 'regles' => $this->regles, 'nb_joueur' => partie()->getNbJoueur()));
}
示例9: showloginform
/**
* Show a login form for when a user needs to link an OIDC account but is not yet logged in locally.
*/
public function showloginform()
{
$smarty = smarty(array(), array(), array(), array('pagehelp' => false, 'sidebars' => false));
$smarty->assign('pagedescriptionhtml', get_string('logintolinkdesc', 'auth.oidc', $this->oidcusername, get_config('sitename')));
$smarty->assign('form', '<div id="loginform_container"><noscript><p>{str tag="javascriptnotenabled"}</p></noscript>' . $this->generate_login_form());
$smarty->assign('PAGEHEADING', get_string('logintolink', 'auth.oidc', get_config('sitename')));
$smarty->assign('LOGINPAGE', true);
$smarty->display('form.tpl');
die;
}
示例10: index
static function index()
{
$head = array('title' => 'EQPHP开源中文WEB应用开发框架');
input::cookie('frame_name', 'EQPHP');
$logo_file = DATA_STORE . 'txt/logo_pic.txt';
$source = base64_decode(file_get_contents($logo_file));
file_put_contents(FILE_CREATE . 'eqphp_logo.png', $source);
$logo = '<img src="' . URL_CREATE . 'eqphp_logo.png">';
smarty()->assign(compact('head', 'logo'))->display('index');
}
示例11: index
static function index()
{
$tpl = smarty();
//设置、输出页面标题和关键词
$head['title'] = '欢迎使用EQPHP案例留言本';
$head['keywords'] = 'EQPHP留言本、简约留言薄、邮件发送、数据安全与过滤';
$head['keywords'] .= 'json数据、权限分配、正则验证、配置文件读取、css sprite';
$tpl->assign('head', $head);
//渲染视图模板
$tpl->display('message/index');
}
示例12: process
public function process()
{
$slots = queryTab('
select * from slot
natural join joueur
where partie_id=' . partie()->getID() . '
order by slot_position
');
smarty()->assign('slots', $slots);
smarty()->assign('options', jeu()->getOptions());
smarty()->assign('isHost', intval(slot()->joueur_id) == intval(partie()->host));
}
示例13: index
static function index()
{
$tpl = smarty();
$head['title'] = 'EQPHP 文件上传(file upload)';
$tpl->assign('head', $head);
$lie = 1;
$param['type'] = url($lie);
$param['dir'] = url($lie + 1);
$param['id'] = url($lie + 2);
$tpl->assign('up', $param);
$tpl->display('plugin/upload');
}
示例14: index
static function index()
{
$admin = session('admin');
//若管理员已登录,跳转至管理首页
if ($admin && $admin['account']) {
http::skip('message/manage');
}
$tpl = smarty();
$head['title'] = '管理员登陆_EQPHP案例留言本';
$tpl->assign('head', $head);
//输出模板
$tpl->display('message/login');
}
示例15: export_submit
function export_submit(Pieform $form, $values)
{
global $SESSION;
$views = array();
foreach ($values as $key => $value) {
if (substr($key, 0, 5) == 'view_' && $value) {
$views[] = intval(substr($key, 5));
}
}
$exportdata = array('format' => $values['format'], 'what' => $values['what'], 'views' => $views);
$SESSION->set('exportdata', $exportdata);
$smarty = smarty();
$smarty->assign('heading', '');
$smarty->display('export/export.tpl');
exit;
}