Hi guys,
I’m configuring the routes of my site, but one of this routes not work.
my config may file is like this:
'urlManager'=>array(
'urlFormat' => 'path',
'showScriptName'=> false,
'rules' => array(
'admin' => 'admin/login/index',
'admin/login' => 'admin/login/login',
'admin/logout' => 'admin/login/logout',
'admin/<_c:(users|highlights|repertory|team|cast)>' => 'admin/<_c>/list',
'admin/<_c:(users|highlights|repertory|team|cast)>/<_a:(create|update|delete)>/<_id:\d+>' => 'admin/<_c>/<_a>',
'equipe' => 'team/index',
'equipe/proficinal/<_id:\d+>' => 'equipe/member',
'<_a:(thebestof|nowplaying|cinema)>' => 'repertory/<_a>',
'thebestof/show/<_id:\d+>' => 'repertory/show',
'nowplaying/show/<_id:\d+>' => 'repertory/show',
'cinema/show/<_id:\d+>' => 'repertory/show',
'home' => 'site/home',
'contato' => 'site/contact',
)
),
and my controller, is like this:
class RepertoryController extends CController
{
private $_model;
public function actionTheBestOf()
{
$pieces = Repertory::model()->published()->currentarea()->ordenation()->findAll();
$this->renderPartial('index', array('pieces' => $pieces));
}
public function actionNowPlaying()
{
$pieces = Repertory::model()->published()->currentarea(2)->ordenation()->findAll();
$this->renderPartial('index', array('pieces' => $pieces));
}
public function actionCinema()
{
$pieces = Repertory::model()->published()->currentarea(3)->ordenation()->findAll();
$this->renderPartial('index', array('pieces' => $pieces));
}
public function actionShow()
{
$piece = $this->loadpiece();
$this->renderPartial('show', array('piece' => $piece));
}
public function loadpiece($id = NULL)
{
if($this->_model === NULL)
{
if($id !== NULL || isset($_GET['id'])) $this->_model = Repertory::model()->findbyPK($id !== NULL ? $id : $_GET['id']);
if($this->_model === NULL) throw new CHttpException(404, 'Peça não existe');
}
return $this->_model;
}
}
All the actions are running just the action "Show" not.
When I call "http://mysite.com/cinema/show/3" not work, but if I call "http://mysite.com/repertory/show/id/1" work perfect.
How can I resolve this problema?
Thanks.