Creating Model Issue


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


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

class can send it to the view ?

In the line


you are missing the closing ) of the function render

It was a typo in the post here, but here is the actual code of controller


class MessageController extends Controller


public function actionShow()


	&#036;model = new RhmForm;



public function actionEdit()




public function actionIndex()





and the code of model class is


class RhmForm extends CFormModel


public &#036;name;

public function rules()


	return array(

		array('name', 'required'),






this line


calls a view show.php

paste that code to see if there is something wrong…

NOTE: use the code directive ([ code] and [ /code] - without spaces) for the code… it’s easier to read…

Thanks for the code tip, well here is the show.php code which resides in /protected/views/message

<h1> This is testing message </h1>


<?php echo $message->name; ?> 


Is there anything I missed?

Don’t really know what’s the problem… the code is good… I just tried it and it’s working for me…

(I just copy/pasted your code for the cotroler,model and view so the code is OK)

:( Thats Strange

Which version of Yii you’re using ?

Yii 1.1.2…

have you checked the Yii requirements?

try to call render without the model just to see if that’s working… like

public function actionShow()




Yes it works like that , I mean


$this->render('show',array('message'=>'hello world'));

Both works but only when I use my own model class it stops working

can you do a remote session to my pc, I am adding my id is ehunt2002

Just got it that it was the code editors problem