Shaani
(Aziz Zee)
1
in controller UaeController I have
'dubai'=>array(
'class'=>'CViewAction',
'basePath'=>'pages/dubai',
),
'abudhabi'=>array(
'class'=>'CViewAction',
'basePath'=>'pages/abudhabi',
),
When I access uae/dubai/downtown-dubai I get 404 page not found error
I’ve tried this
'<controller:\w+>/<action:\w+>/<id:[a-zA-Z\-]>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>/<view:[a-zA-Z\-]>'=>'<controller>/<action>',
and also this
class UrlManager extends CUrlManager
{
public $showScriptName = false;
public $appendParams = false;
public $useStrictParsing = true;
public $urlSuffix = '/';
public function createUrl($route, $params = array(), $ampersand = '&')
{
function mat($matches) {
return '-' . lcfirst($matches[0]);
}
$route = preg_replace_callback('/(?<![A-Z])[A-Z]/', 'mat', $route);
return parent::createUrl($route, $params, $ampersand);
}
public function parseUrl($request)
{
$route = parent::parseUrl($request);
return lcfirst(str_replace(' ', '', ucwords(str_replace('-', ' ', $route))));
}
}
but nothing’s working
zaccaria
(Matteo Falsitta)
2
This one means exactly one character:
'<controller:\w+>/<action:\w+>/<id:[a-zA-Z\-]>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>/<view:[a-zA-Z\-]>'=>'<controller>/<action>',
This one means one or more:
'<controller:\w+>/<action:\w+>/<id:[a-zA-Z\-]+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>/<view:[a-zA-Z\-]+>'=>'<controller>/<action>',
the question is the +, not the hypen
Shaani
(Aziz Zee)
3
I have pages with more than one hyphen too, like Index.php/uae/abudhabi/abu-dhabi-apartments
but this also doesn’t work
'<controller:\w+>/<action:\w+>/<id:[a-zA-Z\-]+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>/<view:[a-zA-Z\-]+>'=>'<controller>/<action>',
Shaani
(Aziz Zee)
4
I tried
'uae/dubai/downtown-dubai'=>'uae/dubai',
but this also doesn’t work