Hi,
I am facing problem in writing rule for the URLManager to get Unlimited depth of Categories and Subcategories
I have created the Url as category/sub-category/sub-category but when I use it without using UrlManger, it works fine but when I use it with UrlManager it gives 404 request not found.
Any help?
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'/'=>'site/index',
array(
'class' => 'application.components.CatUrl',
),
'//'=>'site/page',
'/.html'=>'site/page',
'/site/categories/'=>'site/categories',
'/'=>'/view',
'//'=>'/',
'/'=>'/',
),
),
CatUrl code
public function createUrl($manager,$route,$params,$ampersand)
{
if ($route==='site/page')
{
if (isset($params['parent'], $params['current']))
return $params['parent'] . '/' . $params['current'];
else if (isset($params['current']))
return $params['current'];
}
return false;
}
public function parseUrl($manager,$request,$pathInfo,$rawPathInfo)
{
if (preg_match('%^(\w+)(/(\w+))?$%', $pathInfo, $matches))
{
}
return false;
}