I am going through the following steps to create a mode, controller and view from scratch I have followed the below steps:
1- Created Controller with Yiic Shell —> (then) controller Message show edit
2- Then I went ahead and create model in protected/models/ folder named as MessageForm
3- Then I am using the controller on actionShow to make and object of MessageForm and sending to view as
$this->render(‘show’,array(‘message’=>$model)
but Unfortunately I cannot see anything on the view but some garbled chinese characters and when I view the page source
I see my model class code is embeded in it, why does that happened?
and then when I tried in controller class actionShow method to make and send the object of ContactForm which was created during yiic webapp command then it worked fine.
Could you please tell me why cannot I make a model class manually or do I have to register it somewhere so that my controller
It was a typo in the post here, but here is the actual code of controller
<?php
class MessageController extends Controller
{
public function actionShow()
{
$model = new RhmForm;
$this->render('show',array('message'=>$model));
}
public function actionEdit()
{
$this->render('edit');
}
public function actionIndex()
{
$this->render('index');
}
}
and the code of model class is
<?php
class RhmForm extends CFormModel
{
public $name;
public function rules()
{
return array(
array('name', 'required'),
);
}