mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 05:31:58 +02:00
news URL config fixes
This commit is contained in:
parent
48b9ceb5d2
commit
40509909b6
@ -39,7 +39,9 @@ class core_news_rewrite_url extends eUrlConfig
|
||||
*/
|
||||
public function create($route, $params = array(), $options = array())
|
||||
{
|
||||
$page = $params['page'] ? intval($params['page']) : '0';
|
||||
|
||||
if('--FROM--' != $params['page']) $page = $params['page'] ? intval($params['page']) : '0';
|
||||
else $page = '--FROM--';
|
||||
if(!$route) $route = 'item/default';
|
||||
|
||||
if(is_string($route)) $route = explode('/', $route, 2);
|
||||
@ -75,7 +77,7 @@ class core_news_rewrite_url extends eUrlConfig
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
case 'list':
|
||||
case 'short':
|
||||
if(!vartrue($params['id']))
|
||||
{
|
||||
$r[0] = '';
|
||||
@ -97,20 +99,6 @@ class core_news_rewrite_url extends eUrlConfig
|
||||
$r[0] = $route[1].'-'.$params['id'];
|
||||
break;
|
||||
|
||||
case 'nextprev':
|
||||
$route = $params['route'];
|
||||
unset($params['route']);
|
||||
// prevent dead loop
|
||||
if($route != 'list/nextprev')
|
||||
{
|
||||
$tmp = $this->create($route, $params);
|
||||
$r = $tmp[0];
|
||||
$parm = $tmp[1];
|
||||
$parm['page'] = '[FROM]';
|
||||
unset($tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
@ -33,6 +33,7 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
||||
|
||||
## URL with ID and Title - no DB call, balanced performance!
|
||||
'Category/<id:[\d]+>/<name:[\w\pL.\-\s]+>' => array('list/items', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_title' => 'name'), 'legacyQuery' => 'list.{id}.{page}'),
|
||||
|
||||
## URL with ID only - best performance!
|
||||
// 'Category/<id:[\d]+>' => array('list/items', 'allowVars' => array('page'), 'legacyQuery' => 'list.{id}.{page}', 'mapVars' => array('category_id' => 'id')),
|
||||
## URL with Title only - prettiest and slowest!
|
||||
@ -44,7 +45,9 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
||||
// to be noted here - value 'name' is replaced by item id within the callback method; TODO replace news_title with news_sef field
|
||||
// 'View/<name:[\w\pL.\-\s]+>' => array('view/item', 'mapVars' => array('news_title' => 'name'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||
// 'View/<id:[\d]+>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
||||
|
||||
|
||||
## URL with ID and Title - no DB call, balanced performance!
|
||||
'Short/<id:[\d]+>/<name:[\w\pL.\-\s]+>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_title' => 'name'), 'legacyQuery' => 'list.{id}.{page}'),
|
||||
|
||||
// less used after
|
||||
'Brief/<id:[\d]+>' => array('list/short', 'allowVars' => array('page'), 'legacyQuery' => 'cat.{id}.{page}', 'mapVars' => array('news_id' => 'id')),
|
||||
|
Loading…
x
Reference in New Issue
Block a user