Hi guys,
I created a controller pageController to handle pages, and I make it the default controller in the config/main.php file.
In this controller I make the default action as 'show' which looks like that:
The problem is that I can't figure out how to pass the slug from the request to this actionShow() method.
Thanks in advance
I created a controller pageController to handle pages, and I make it the default controller in the config/main.php file.
In this controller I make the default action as 'show' which looks like that:
public function actionShow( $slug = '' ) {
if ( empty( $slug ) ) {
$model=Pages::model()->findByAttributes( array( 'slug' => 'accueil' ) );
}
else {
$model = Pages::model()->find('slug = :slug', array(':slug' => $slug));
if($model===null) {
//throw new CHttpException(404,'The requested page does not exist.');
$slug = 'not found';
}
}
$this->render('page', array(
'model' => $model,
'slug' => $slug,
));
}
The problem is that I can't figure out how to pass the slug from the request to this actionShow() method.
Thanks in advance