mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
news URL config fixes
This commit is contained in:
@@ -39,7 +39,9 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
*/
|
*/
|
||||||
public function create($route, $params = array(), $options = array())
|
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(!$route) $route = 'item/default';
|
||||||
|
|
||||||
if(is_string($route)) $route = explode('/', $route, 2);
|
if(is_string($route)) $route = explode('/', $route, 2);
|
||||||
@@ -75,7 +77,7 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
case 'list':
|
case 'short':
|
||||||
if(!vartrue($params['id']))
|
if(!vartrue($params['id']))
|
||||||
{
|
{
|
||||||
$r[0] = '';
|
$r[0] = '';
|
||||||
@@ -97,20 +99,6 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
$r[0] = $route[1].'-'.$params['id'];
|
$r[0] = $route[1].'-'.$params['id'];
|
||||||
break;
|
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:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -33,6 +33,7 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
|
|
||||||
## URL with ID and Title - no DB call, balanced performance!
|
## 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}'),
|
'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!
|
## URL with ID only - best performance!
|
||||||
// 'Category/<id:[\d]+>' => array('list/items', 'allowVars' => array('page'), 'legacyQuery' => 'list.{id}.{page}', 'mapVars' => array('category_id' => 'id')),
|
// '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!
|
## 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
|
// 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/<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}'),
|
// '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
|
// less used after
|
||||||
'Brief/<id:[\d]+>' => array('list/short', 'allowVars' => array('page'), 'legacyQuery' => 'cat.{id}.{page}', 'mapVars' => array('news_id' => 'id')),
|
'Brief/<id:[\d]+>' => array('list/short', 'allowVars' => array('page'), 'legacyQuery' => 'cat.{id}.{page}', 'mapVars' => array('news_id' => 'id')),
|
||||||
|
Reference in New Issue
Block a user