hi, i have struggled through to chapter 12 now. It adds an admin module to trackstar application. The module seems use the application layout back at protected/views/layouts by default. i copied the 3 files (main.php, column1.php, column2.php) to protected/modules/admin/views/layouts, and added this line to the method init() in adminModule.php:
$this->layout=‘main’;
it doesn’t do any good. the module still uses the application layout. i then add this line to the beforeControllerAction($controller, $action) method:
$controller->layout=‘main’;
this time it works. Admin module uses the local layout now.
but when i add the SysMessage model to the Admin module, all the CRUD operation view files go back to application layout at system layout direcotry again.
class SysMessageController extends Controller
{
public $layout='column2'; //following page 301, but this line doesn't do any good. the module still uses application layout back at system layout directory.
public function actionView($id)
{
$this->layout='column2'; // this line makes the view use the main.php layout back at system layout directory again. it's really weird.
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
}
Can anybody give me a hint? thank you so much.