本文整理汇总了PHP中Vars::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Vars::set方法的具体用法?PHP Vars::set怎么用?PHP Vars::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vars
的用法示例。
在下文中一共展示了Vars::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
<?php
if (!defined('BASEPATH')) {
exit('Nu poti accesa acest fisier direct.');
}
$expire = $CFG->get('rank_regenerate');
$expire = 0;
if (Cache::is_cached('top_10_players', $expire)) {
Vars::set('players_rank', Cache::get('top_10_players'));
} else {
$players = array();
$sql = "SELECT player.id, player.name, player.level, player_index.empire \n FROM " . PLAYER_DATABASE . ".player \n LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id=player.account_id \n LEFT JOIN " . PLAYER_DATABASE . ".guild_member ON guild_member.pid=player.id \n INNER JOIN " . ACCOUNT_DATABASE . ".account \n ON account.id=player.account_id\n WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'\n ORDER BY player.level DESC, player.exp DESC LIMIT 10";
$query = $DB->query($sql);
while ($row = $DB->fetch($query)) {
$players[] = $row;
}
Cache::set('top_10_players', $players);
Vars::set('players_rank', $players);
}
if (Cache::is_cached('top_10_guilds', $expire)) {
Vars::set('guilds_rank', Cache::get('top_10_guilds'));
} else {
$guilds = array();
$sql = "SELECT \n guild.name, guild.level, guild.win, guild.ladder_point, player_index.empire\n FROM " . PLAYER_DATABASE . ".guild \n LEFT JOIN " . PLAYER_DATABASE . ".player ON guild.master = player.id \n LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id = player.account_id \n WHERE player.name NOT LIKE '[%]%' \n ORDER BY guild.ladder_point DESC LIMIT 10";
$query = $DB->query($sql);
while ($row = $DB->fetch($query)) {
$guilds[] = $row;
}
Cache::set('top_10_guilds', $guilds);
Vars::set('guilds_rank', $guilds);
}
示例2: define
/**
* @todo: Replace this code with a proper router
**/
define('DS', DIRECTORY_SEPARATOR);
define('BASEPATH', realpath(dirname(__FILE__)) . DS);
define('APPPATH', BASEPATH . 'application' . DS);
require BASEPATH . 'system' . DS . 'core.php';
define('LOGGED_IN', is_logged_in());
$smarty->assign('logged_in', LOGGED_IN);
if (isset($_SESSION['user_data']['id'])) {
$smarty->assign('user_id', $_SESSION['user_data']['id']);
} else {
$smarty->assign('user_id', 0);
}
/* ----- Use a router insted ----- */
$query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
$req_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$request = str_replace($CFG->get('relative_path'), '', $req_uri);
$request = str_replace('?' . $query, '', $request);
$url_parts = explode('/', trim($request, '/'));
$url_parts[0] = isset($url_parts[0]) && $url_parts[0] != '' ? $url_parts[0] : '';
$url_parts = str_replace('..', '', $url_parts);
/* ---------- */
$file = plugin($url_parts);
Vars::set('args', $url_parts);
Vars::set('plain_args', implode('/', $url_parts));
require $file;
require BASEPATH . 'getRank.php';
$smarty->assign('players_rank', Vars::get('players_rank'));
$smarty->assign('guilds_rank', Vars::get('guilds_rank'));
$smarty->display('main.tpl');