本文整理汇总了PHP中router::get方法的典型用法代码示例。如果您正苦于以下问题:PHP router::get方法的具体用法?PHP router::get怎么用?PHP router::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类router
的用法示例。
在下文中一共展示了router::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: path
function path()
{
$sep = ' <span>→</span> ';
$first = params::get('first');
$last = params::get('last');
$i = 0;
foreach (web::$pages as $v) {
if ($first == 'no' && $v['page_folder'] == '/') {
continue;
}
if ($last == 'no' && $v['page_id'] == PAGE_ID) {
continue;
}
if ($v['page_folder'] == '/users/[dynamic]/') {
$v['page_folder'] = '/users/' . router::get(1) . '/';
$v['page_title'] = router::get(1);
}
if ($v['page_id'] == PAGE_ID) {
$path_item = web::get('page_title');
} else {
$path_item = '<a href="' . $v['page_folder'] . '">' . $v['page_title'] . '</a>';
}
s::roll('page_path', array('path_item' => $path_item));
if ($v['page_id'] != PAGE_ID) {
s::roll('page_path', array('path_item' => $sep));
}
}
}
示例2: getJson
public function getJson($addWhere = '', $addSql = '', $showMax = 12)
{
$sort = input::getInput("mix.sort") ? input::getInput("mix.sort") : 'id';
$order = input::getInput("mix.order") ? input::getInput("mix.order") : "asc";
$page = input::getInput("mix.page") ? input::getInput("mix.page") : 1;
$rows = input::getInput("mix.rows") ? input::getInput("mix.rows") : 10;
$db = sf::getLib("db");
if ($select) {
$sql = $select . " ";
} else {
$sql = "SELECT * FROM `" . $this->table . "` ";
}
$addWhere && ($sql .= "WHERE " . $addWhere . " ");
if ($addSql) {
$sql .= $addSql . " ";
} else {
$sql .= " ORDER BY {$sort} {$order} ";
}
if (!router::get("totalnum" . $key)) {
$query = $db->query($sql);
$total = $db->num_rows($query);
} else {
$total = router::get("totalnum" . $key);
}
$sql .= "LIMIT " . $rows * ($page - 1) . "," . $rows;
$query = $db->query($sql);
while ($row = $db->fetch_array($query)) {
$result[] = $this->fillObject($row)->toArray();
}
return '{"total":' . $total . ',"rows":' . json_encode($result) . '}';
}
示例3: getColumnStr
function getColumnStr($subject = '', $orderfield = '')
{
$result = router::get();
$result['ordermode'] = $result['ordermode'] == 'DESC' ? 'ASC' : 'DESC';
$result['orderfield'] = $orderfield;
$str = array_shift($result);
$str .= '/' . array_shift($result);
foreach ($result as $key => $val) {
$str .= '/' . $key . '/' . $val;
}
return link_to($str, $subject, array('class' => $result['ordermode']));
}
示例4: start
function start()
{
db::connect();
if (!router::get(1)) {
return true;
}
self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
define('APP', APPS . self::get('app') . '/');
s::set('APP', APP);
define('MODULE', APP . self::get('module') . '/');
s::set('MODULE', MODULE);
if (stristr(self::$map['mode'], 'admin')) {
self::$map['mode'] = 'admin';
} else {
self::$map['mode'] = 'web';
}
if (self::$map['mode'] == 'admin') {
if (defined('ADMIN_USER_SITE_ID')) {
admin::observer();
define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
db::table('admin_sites');
db::where('site_id', ADMIN_USER_SITE_ID);
db::limit(1);
$row = db::select();
define('ADMIN_SITE', db::get('site_domain'));
s::set('ADMIN_SITE', ADMIN_SITE);
}
} else {
web::getSite();
$lang = lang::gets(LANG_INDEX, SITE_ID);
/*
Authentification webUser
*/
web::observer();
}
/*
Set params
*/
params::send();
if (router::get(0) == 'feed' || router::get(0) == 'rss') {
self::$map['module'] = 'feed';
}
if (self::$map['mode'] == 'admin') {
load::module(self::get('app'), self::get('module'), self::get('action'));
} else {
load::handler(self::get('app'), self::get('module'), self::get('action'));
}
}
示例5: getPager
public function getPager($addWhere = '', $addSql = '', $showMax = 20, $select = '', $key = '', $form_vars = array())
{
$db = sf::getLib("db");
if ($select) {
$sql = $select . " ";
} else {
$sql = "SELECT * FROM `" . $this->table . "` ";
}
$addWhere && ($sql .= "WHERE " . $addWhere . " ");
$addSql && ($sql .= $addSql . " ");
if (!router::get("totalnum" . $key)) {
$query = $db->query($sql);
$total = $db->num_rows($query);
} else {
$total = router::get("totalnum" . $key);
}
$pager = sf::getLib("pager", $total, $showMax, $key, $form_vars);
$sql .= "LIMIT " . $pager->getStartNum() . "," . $pager->getShowNum();
$query = $db->query($sql);
$pager->setField($db->result_array($query));
$pager->setObject(clone $this);
return $pager;
}
示例6: getColumnStr
function getColumnStr($subject = '', $orderfield = '')
{
$result = router::get();
$o_orderfield = $result['orderfield'];
$result['ordermode'] = $result['ordermode'] == 'DESC' ? 'ASC' : 'DESC';
$result['orderfield'] = $orderfield;
if (config::get('token_open', false)) {
array_shift($result);
unset($_GET['token']);
unset($result['token']);
}
$str = array_shift($result);
$str .= '/' . array_shift($result);
foreach ($result as $key => $val) {
$str .= '/' . $key . '/' . $val;
}
//为排序字段加上标记
if ($o_orderfield == $orderfield) {
$class = array('class' => $result['ordermode']);
} else {
$class = array();
}
return link_to($str, $subject, $class);
}
示例7: map
function map()
{
self::$map = array('app' => router::get(1), 'module' => router::get(2), 'action' => router::get(3), 'id' => router::get(4), 'title' => 'Legenda', 'mode' => 'simple', 'rule' => 'all');
if (!router::get(1)) {
self::$map['app'] = self::$start_app;
}
if (!router::get(2)) {
self::$map['module'] = 'main';
}
if (!router::get(3)) {
self::$map['action'] = 'view';
}
}
示例8: start
function start()
{
db::connect();
if (!router::get(1)) {
return true;
}
self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2));
if (router::get(3)) {
self::set('module', router::get(2));
self::set('action', router::get(3));
}
s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
define('APP', APPS . self::get('app') . '/');
s::set('APP', APP);
define('MODULE', APP . self::get('module') . '/');
s::set('MODULE', MODULE);
/*
Lang items
*/
if (self::get('mode') == 'webAjax') {
web::getSite();
$lang = lang::gets(LANG_INDEX, SITE_ID);
/*
Authentification webUser
*/
web::observer();
} else {
define('LANG_INDEX', SYS_INDEX);
$lang = lang::gets(LANG_INDEX);
admin::observer();
if (defined('ADMIN_USER_SITE_ID')) {
define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
$group_rules = ini::parse(SYS_ROOT . 'conf/admin/groups.ini', ADMIN_USER_GROUP_ID);
define('RULE', $group_rules['rule']);
db::table('admin_sites');
db::where('site_id', ADMIN_USER_SITE_ID);
db::limit(1);
define('ADMIN_SITE', db::get('site_domain'));
s::set('ADMIN_SITE', ADMIN_SITE);
}
}
/*
Set params
*/
params::send();
$tmpl = params::get('tmpl');
$sys = false;
if (self::get('mode') == 'adminAjax') {
$sys = true;
}
buffer::init(0, self::get('app'), false, $tmpl);
if (self::get('mode') == 'webAjax') {
load::handler(self::get('app'), self::get('module'), self::get('action'));
} else {
load::module(self::get('app'), self::get('module'), self::get('action'));
}
/*
Get plugin action
*/
ob_start();
/*
запуск обработчика с возвратом данных
тут два варианта либо данные просто выводим если нет шаблона, а если есть то сначала обрабатываем шаблон
если буффер полный выводим информацию из него
*/
$buffer = buffer::gets();
if ($buffer[0]) {
if ($sys) {
buffer::$module = self::get('module');
}
$section = params::get('section');
echo buffer::get($buffer[0]['app'], $buffer[0]['tmpl'], $buffer[0]['data'], $section, $sys);
}
$code = ob_get_contents();
ob_clean();
s::$mode = 'code';
s::setTmpl($code, $lang);
s::display();
}
示例9: get
function get($url, $fun)
{
router::get($url, $fun);
}