help for yii

i am a begginer in learning yii framework. i need tutorials for layouts and exception handling. kindly help me .

Read the Wikiand Tutorials

After that, if encounter a problem, then share and get help.

Thank you so much for your reply. i have been reading Agile Web Application Development with Yii1.1 and PHP5.

But Exception handling and populating a dropdownlist from a database is getting difficult to understand.

I don’t have this book, so I cannot help with it.

Can you tell us what exaclty are you trying to achive? Maybe we can help in something of specific.

I have two tables related by integrity constraint. Now i want to provide option for the user to select the foreign key through a dropdownlist instead of user entering the data. So i am not able to write the code for getting data from database into the dropdownlist.Kinldy help me.

<?php echo $form->dropDownList($model, 'school', CHtml::listData(School::model()->findAll(), 'id', 'name'))?>

If you have a model of students with fk on school, for example

I have Society as parent table and Block as Child table.

Society had "id" as primary key with autoincrement.

Block has Society_id as a normal field with not null constraint.

I have associated "Society_id" as referencial key with "id" feild of Society table.

the following i worte but its not wirking sir.

<?php echo $form->dropDownList($model, ‘Society’, CHtml::listData(School::model()->findAll(), ‘id’, ‘society_id’));?>

kindly help me

That book is full of typos and mistake. Don’t start with that book if you’re absolutely new.

You should start with Larry’s tutorial. He covered exectly the “drop down list from database” you asked.

Then move on to the blog tutorial on this website

Just a note: at first you where asking for tutorials about layouts and exceptions… now you are on dropdowns…

As for your dropdownlist… as a second parameter goes the model attribute… you put there ‘Society’… but if I understood you right… this is the model… you need to put there your attribute name (society_id?)…

Tt was a mistake while i was typing it sir.

<?php echo $form->dropDownList($model, ‘Society’, CHtml::listData(Society::model()->findAll(), ‘id’, ‘society_id’));?>

This is not working

Thank you fir this. I will study the same

read again my post… "second parameter of the dropDownList"… you put "Society" there… is that the name of your attribute?

Society is name of the model

society_id is the name of the attribute sir

This is the code i worte

<?php echo $form->dropDownList($model,‘socity_id’, CHtml::listData(Society::model()->findAll(), ‘id’,‘socity_id’)); ?>

The error i am getting:

                   Property &quot;Society.socity_id&quot; is not defined.

Note :Socity_id is the feild name in the database

kindly help me please

Note: when posting code, use the code button on the editor toolbar (<>) so that the code is more readable…

As for the problem… check your spelling… In the first post you wrote that the attribute is "society_id"… but the error say "socity_id" (missing "e")

Sorry for that sir. certainly i will do as u said.

while creating the table i gave the field name as Socity_id .

and i developed all the CRUD operations using yii. when i thought of editing the database field there came editing of files like model , form.php, _view.php …

so i left that name as socity_id sir.

fianlly this is working

<<?php echo $form->dropDownList($model,‘socity_id’, CHtml::listData(Society::model()->findAll(), ‘id’, ‘id’)); ?>>

<?php echo $form->dropDownList($model,’<label name>’, CHtml::listData(<Model name>::model()->findAll(), ‘<columnname>’, ‘<column name>’)); ?>

Thanks for all the feedback.

Are there any coding standard that are needed to be followed in yii.

what is the Deliverable formats in yii

Please suggest me.

Thanks a lot in advance

These are as of General Programming Standards.

Your Application along with Yii Framework(if not installed on the server)

so we can give the application as it is to the customer?

I mean no other conventions to be followed.

I need Exception handling in yii framework . please kindly help me