本文整理汇总了PHP中smarty::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP smarty::assign方法的具体用法?PHP smarty::assign怎么用?PHP smarty::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smarty
的用法示例。
在下文中一共展示了smarty::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gb_once
function gb_once($id)
{
global $db, $countries;
$row = $db->fetch_assoc('SELECT
a.author, a.homepage, a.email, a.comID, a.beitrag, a.datum, COUNT(b.comID) as comments
FROM
' . DB_PRE . 'ecp_comments as a
LEFT JOIN ' . DB_PRE . 'ecp_comments as b ON (b.subID = a.comID AND b.bereich = "gb_com")
WHERE
a.bereich = "guestbook" AND a.comID = ' . $id . '
GROUP BY a.comID');
if ($db->num_rows()) {
$comments = array();
$row['nr'] = 1;
$row['datum'] = date(LONG_DATE, $row['datum']);
$comments[] = $row;
$tpl = new smarty();
$tpl->assign('ajax', 1);
$tpl->assign('comments', $comments);
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK, $content, '', 1);
} else {
table(GUESTBOOK, NO_ENTRIES_ID);
}
}
示例2: admin_joinus
function admin_joinus()
{
global $db, $countries;
$tpl = new smarty();
$db->query('SELECT tname, `joinID`, `name`, b.username, b.email, b.icq, b.msn, `age`, b.country, `teamID`, `comment`, `IP`, `datum`, `closed`, `closedby`, a.username as closedby_username FROM ' . DB_PRE . 'ecp_joinus as b LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (ID=closedby) ORDER BY closed ASC, datum ASC');
$joinus = array();
while ($row = $db->fetch_assoc()) {
$row['datum'] = date(SHORT_DATE, $row['datum']);
if ($row['joinID'] == (int) @$_GET['id']) {
$spe = $row;
}
$joinus[] = $row;
}
if (@$spe) {
ob_start();
$tpl1 = new Smarty();
foreach ($spe as $key => $value) {
$tpl1->assign($key, $value);
}
$tpl1->assign('countryname', $countries[$spe['country']]);
$tpl1->assign('id', $row['joinID']);
$tpl1->display(DESIGN . '/tpl/admin/joinus_view.html');
$tpl->assign('details', ob_get_contents());
ob_end_clean();
}
$tpl->assign('joinus', $joinus);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/joinus.html');
$content = ob_get_contents();
ob_end_clean();
main_content(JOINUS, $content, '', 1);
}
示例3: shoutbox
function shoutbox()
{
global $db, $countries;
$tpl = new smarty();
$anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich="shoutbox"');
if ($anzahl) {
$limits = get_sql_limit($anzahl, LIMIT_SHOUTBOX);
$shouts = array();
$db->query('SELECT comID, country, username, userID, author, datum, beitrag FROM ' . DB_PRE . 'ecp_comments LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID WHERE bereich="shoutbox" ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_SHOUTBOX);
$anzahl -= $limits[1];
while ($row = $db->fetch_assoc()) {
$row['nr'] = format_nr($anzahl--, 0);
$row['countryname'] = @$countries[$row['country']];
$row['datum'] = date(LONG_DATE, $row['datum']);
$shouts[] = $row;
}
$tpl->assign('shoutbox', $shouts);
if ($limits[0] > 1) {
$tpl->assign('seiten', makepagelink_ajax('?section=shoutbox', 'return load_shout_page({nr});', @$_GET['page'], $limits[0]));
}
ob_start();
$tpl->display(DESIGN . '/tpl/shoutbox/shoutbox.html');
$content = ob_get_contents();
ob_end_clean();
main_content(SHOUTBOX, '<div id="shout_overview">' . $content . '</div>', '', 1);
} else {
table(INFO, NO_ENTRIES);
}
}
示例4: main_content
function main_content($headline, $content, $footer = '', $mode = 0)
{
$tpl = new smarty();
if ($mode == 1) {
$tpl->assign('headline', 'templates/' . DESIGN . '/picture.php?text=' . base64_encode('» ' . $headline));
} else {
$tpl->assign('headline', $headline);
}
$tpl->assign('content', $content);
$tpl->assign('footer', $footer);
$tpl->assign('mode', $mode);
$tpl->display(DESIGN . '/tpl/content.html');
}
示例5: render
public function render()
{
$this->_getContext($this->controller);
$path = get_class($this->controller);
$file = $this->_parseTemplatePath($path);
if (!file_exists(APP_TEMPLATE_PATH . DS . $file)) {
throw new AXION_EXCEPTION('没有找到模板文件');
}
foreach ($this->context as $k => $v) {
$this->templateInstance->assign($k, $v);
}
$_str_resultHTML = $this->templateInstance->fetch($file);
return $_str_resultHTML;
}
示例6: genHtml
/**
* @param $template
* @param $ary
* @return mixed
*/
public static function genHtml($template, $ary)
{
$smarty = new smarty();
$smarty->settemplatedir(BASE_PATH . '/resources/email/');
$smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
$smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
// add config
$smarty->assign('config', Config::getPublicConfig());
$smarty->assign('analyticsCode', DbConfig::get('analytics-code'));
foreach ($ary as $key => $value) {
$smarty->assign($key, $value);
}
return $smarty->fetch($template);
}
示例7: newSmarty
public static function newSmarty()
{
$smarty = new smarty();
//实例化smarty
$smarty->settemplatedir(BASE_PATH . '/resources/views/' . Config::get('theme') . '/');
//设置模板文件存放目录
$smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
//设置生成文件存放目录
$smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
//设置缓存文件存放目录
// add config
$smarty->assign('config', Config::getPublicConfig());
$smarty->assign('user', Auth::getUser());
return $smarty;
}
示例8: foreach
function admin_texte()
{
global $db, $countries;
if (isset($_POST['submit'])) {
foreach ($_POST as $key => $value) {
if (strpos($key, '_h_')) {
$lang = substr($key, 0, strpos($key, '_'));
$name = substr($key, strpos($key, '_') + 3);
$sql = sprintf('UPDATE ' . DB_PRE . 'ecp_texte SET content = \'%s\', content2 = \'%s\' WHERE name= \'%s\' AND lang = \'%s\';', strsave($_POST[$lang . '_' . $name]), strsave($value), strsave($name), strsave($lang));
$db->query($sql);
}
}
header('Location: ?section=admin&site=texte');
} else {
$tpl = new smarty();
$lang = get_languages();
$db->query('SELECT * FROM ' . DB_PRE . 'ecp_texte ORDER BY lang ASC');
while ($row = $db->fetch_assoc()) {
foreach ($lang as $key => $value) {
if ($value['lang'] == $row['lang']) {
$lang[$key]['data'][$row['name']] = htmlspecialchars($row['content']);
$lang[$key]['headline'][$row['name']] = htmlspecialchars($row['content2']);
}
}
}
$tpl->assign('lang', $lang);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/texte.html');
$content = ob_get_contents();
ob_end_clean();
main_content(TEXTE, $content, '', 1);
}
}
示例9: get_ranks
function get_ranks()
{
global $db;
if (!isset($_SESSION['rights']['admin']['ranks']) and !isset($_SESSION['rights']['superadmin'])) {
echo NO_ADMIN_RIGHTS;
} else {
$tpl = new smarty();
if (@$_GET['ajax']) {
ob_end_clean();
}
$ranks = array();
$result = $db->query('SELECT rankID, rankname, iconname, abposts, fest, money FROM ' . DB_PRE . 'ecp_ranks ORDER BY fest DESC, abposts, rankname');
while ($row = mysql_fetch_assoc($result)) {
$row['abposts'] = format_nr($row['abposts'], 0);
$row['money'] = format_nr($row['money'], 2);
$ranks[] = $row;
}
$tpl->assign('ranks', $ranks);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/ranks_overview.html');
$content = ob_get_contents();
ob_end_clean();
if (@$_GET['ajax']) {
echo html_ajax_convert($content);
die;
}
main_content(OVERVIEW, '<div id="ranks_overview">' . $content . '</div>', '', 1);
}
}
示例10: get_server
function get_server()
{
global $db;
if (!isset($_SESSION['rights']['admin']['server']) and !isset($_SESSION['rights']['superadmin'])) {
echo NO_ADMIN_RIGHTS;
} else {
$tpl = new smarty();
if (@$_GET['ajax']) {
ob_end_clean();
}
$server = array();
$result = $db->query('SELECT `serverID`, `gamename`, response, `gametype`, `aktiv`, `displaymenu`, `ip`, `port`, `queryport`, `stat` FROM ' . DB_PRE . 'ecp_server ORDER BY posi ASC');
while ($row = mysql_fetch_assoc($result)) {
$data = unserialize($row['response']);
$row['path'] = 'images/server/maps/' . $row['gametype'] . '/' . $data['s']['game'] . '/' . $data['s']['map'] . '.jpg';
$server[] = $row;
}
$tpl->assign('server', $server);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/server_overview.html');
$content = ob_get_contents();
ob_end_clean();
if (@$_GET['ajax']) {
echo html_ajax_convert($content);
die;
}
main_content(OVERVIEW, '<div id="server_overview">' . $content . '</div>', '', 1);
}
}
示例11: get_smilies
function get_smilies()
{
global $db;
if (!isset($_SESSION['rights']['admin']['smilies']) and !isset($_SESSION['rights']['superadmin'])) {
echo NO_ADMIN_RIGHTS;
} else {
$tpl = new smarty();
if (@$_GET['ajax']) {
ob_end_clean();
}
$smilies = array();
$result = $db->query('SELECT ID, filename, bedeutung FROM ' . DB_PRE . 'ecp_smilies ORDER BY ID ASC');
while ($row = mysql_fetch_assoc($result)) {
$smilies[] = $row;
}
$tpl->assign('smilies', $smilies);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/smilies_overview.html');
$content = ob_get_contents();
ob_end_clean();
if (@$_GET['ajax']) {
echo html_ajax_convert($content);
die;
}
main_content(OVERVIEW, '<div id="smilie_overview">' . $content . '</div>', '', 1);
}
}
示例12: get_teams
function get_teams()
{
global $db;
$tpl = new smarty();
if (@$_GET['ajax']) {
ob_end_clean();
}
$teams = array();
$result = $db->query('SELECT tname, tID, info FROM ' . DB_PRE . 'ecp_teams ORDER BY posi ASC');
while ($row = mysql_fetch_assoc($result)) {
$members = array();
$subresult = $db->query('SELECT `username`, `mID`, `userID`, `name`, `aufgabe`, `aktiv`, country FROM ' . DB_PRE . 'ecp_members LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID = userID) WHERE teamID = ' . $row['tID'] . ' ORDER BY posi ASC');
while ($subrow = mysql_fetch_assoc($subresult)) {
$subrow['aktiv'] ? $subrow['aktiv'] = '<span class="member_aktiv" style="cursor:pointer" onclick="member_switch_status(' . $row['tID'] . ', ' . $subrow['userID'] . ');">' . AKTIV . '</span>' : ($subrow['aktiv'] = '<span style="cursor:pointer" class="member_inaktiv" onclick="member_switch_status(' . $row['tID'] . ', ' . $subrow['userID'] . ');">' . INAKTIV . '</span>');
if ($subrow['name'] != '') {
$subrow['username'] = $subrow['name'];
}
$members[] = $subrow;
}
$row['members'] = $members;
$teams[] = $row;
}
$tpl->assign('teams', $teams);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/teams_overview.html');
$content = ob_get_contents();
ob_end_clean();
if (@$_GET['ajax']) {
echo html_ajax_convert($content);
die;
}
main_content(OVERVIEW, '<div id="teams_overview">' . $content . '</div>', '', 1);
}
示例13: get_links
function get_links()
{
global $db;
if (!isset($_SESSION['rights']['admin']['links']) and !isset($_SESSION['rights']['superadmin'])) {
echo NO_ADMIN_RIGHTS;
} else {
$tpl = new smarty();
if (@$_GET['ajax']) {
ob_end_clean();
}
$links = array();
$result = $db->query('SELECT `linkID`, `name`, `url`, `bannerurl`, `beschreibung`, `hits` FROM ' . DB_PRE . 'ecp_links ORDER BY name ASC');
while ($row = mysql_fetch_assoc($result)) {
$links[] = $row;
}
$tpl->assign('links', $links);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/links_overview.html');
$content = ob_get_contents();
ob_end_clean();
if (@$_GET['ajax']) {
echo html_ajax_convert($content);
die;
}
main_content(OVERVIEW, '<div id="links_overview">' . $content . '</div>', '', 1);
}
}
示例14: unset
function admin_settings()
{
global $db, $countries;
if (isset($_POST['submit'])) {
unset($_POST['submit']);
$_POST['SITE_URL'] = strrpos($_POST['SITE_URL'], '/') !== strlen($_POST['SITE_URL']) - 1 ? check_url($_POST['SITE_URL'] . '/') : check_url($_POST['SITE_URL']);
$sql = 'UPDATE ' . DB_PRE . 'ecp_settings SET ';
foreach ($_POST as $key => $value) {
$sql .= $key . ' = "' . strsave($value) . '", ';
}
$sql = substr($sql, 0, strlen($sql) - 2);
if ($db->query($sql)) {
header('Location: ?section=admin&site=settings');
}
} else {
$dir = scan_dir('templates', true);
$designs = '';
foreach ($dir as $value) {
if (is_dir('templates/' . $value)) {
$designs .= '<option ' . ($value == DESIGN ? 'selected="selected"' : '') . ' value="' . $value . '">' . $value . '</option>';
}
}
$tpl = new smarty();
$tpl->assign('designs', $designs);
$tpl->assign('langs', get_languages());
$dir = scan_dir('module', true);
$start = '';
foreach ($dir as $value) {
if (is_dir('module/' . $value)) {
$start .= '<option ' . ('modul|' . $value == STARTSEITE ? 'selected="selected"' : '') . ' value="modul|' . $value . '">' . $value . '</option>';
}
}
$start .= '<option value="">-----' . OWN_SITES . '----</option>';
$db->query('SELECT headline, cmsID FROM ' . DB_PRE . 'ecp_cms ORDER BY headline ASC');
while ($row = $db->fetch_assoc()) {
$title = json_decode($row['headline'], true);
isset($title[LANGUAGE]) ? $title = $title[LANGUAGE] : ($title = $title[DEFAULT_LANG]);
$start .= '<option ' . ('cms|' . $row['cmsID'] == STARTSEITE ? 'selected="selected"' : '') . ' value="cms|' . $row['cmsID'] . '">' . $title . '</option>';
}
$tpl->assign('startseite', $start);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/settings.html');
$content = ob_get_contents();
ob_end_clean();
main_content(SETTINGS, $content, '', 1);
}
}
示例15: admin_server
function admin_server()
{
global $db;
$tpl = new smarty();
$db->query('SELECT `ID`, `verwendung`, `intervall`, `betrag`, `nextbuch` FROM ' . DB_PRE . 'ecp_clankasse_auto');
$auto = array();
while ($row = $db->fetch_assoc()) {
$row['nextbuch'] = date(LONG_DATE, $row['nextbuch']);
$row['betrag'] = number_format($row['betrag'], 2, ',', '.');
$auto[] = $row;
}
$tpl->assign('auto', $auto);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/clankasse_auto_overview.html');
$content = ob_get_contents();
ob_end_clean();
$tpl->assign('overview', $content);
$db->query('SELECT a.*, b.username FROM ' . DB_PRE . 'ecp_clankasse_transaktion as a LEFT JOIN ' . DB_PRE . 'ecp_user as b ON b.ID = vonuser ORDER BY datum DESC');
$buchung = array();
while ($row = $db->fetch_assoc()) {
$row['datum'] = date(LONG_DATE, $row['datum']);
if ($row['vonuser']) {
$row['verwendung'] .= ' ' . FROM . ' ' . $row['username'];
}
$row['geld'] = number_format($row['geld'], 2, ',', '.');
$buchung[] = $row;
}
$tpl->assign('buchung', $buchung);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/clankasse_trans_overview.html');
$content = ob_get_contents();
ob_end_clean();
$tpl->assign('buch_overview', $content);
$db->query('SELECT username, userID, verwendung, monatgeld FROM ' . DB_PRE . 'ecp_clankasse_member LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID ORDER BY username ASC');
$user = array();
while ($row = $db->fetch_assoc()) {
$row['geld'] = number_format($row['monatgeld'], 2, ',', '.');
$user[] = $row;
}
$tpl->assign('user', $user);
ob_start();
$tpl->display(DESIGN . '/tpl/admin/clankasse_user_overview.html');
$content = ob_get_contents();
ob_end_clean();
$tpl->assign('user_trans', $content);
$konto = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_clankasse');
$konto['kontostand'] = number_format($konto['kontostand'], 2, ',', '');
foreach ($konto as $key => $value) {
$tpl->assign($key, $value);
}
$tpl->assign('options', get_options(date('m'), date('Y')));
ob_start();
$tpl->display(DESIGN . '/tpl/admin/clankasse.html');
$content = ob_get_contents();
ob_end_clean();
main_content(FINANCES, $content, '', 1);
}