i'm currently a newbie when it comes to the yii framework / php. I would like some assistance creating this Chtml::DropDownList.
http://www.yiiframework.com/doc/api/1.1/CHtml#dropDownList-detail
Chtml::dropDownList($name, $select, $data)
I understand that $data is the array of data I will be loading in from my Database.
But can someone explain to me how $name, and $select truly works. I have a hard time finding documentation that explains this at a extremely dumbdown level.
I manage to get this piece of code working, but I would prefer using Chtml::dropdownlist.
<div class="row">
<?php
echo $form->dropDownList($model, 'id',
Chtml::listData(UsersTeam::model()->findAllByAttributes(array('coachId'=>$model->id)), 'id', 'teamName'),
array('empty'=>'Select Team'))
?>
</div>
I would like to be able to display all teamName for the current user that he is enlisted in.
I'm currently displaying this in the model view of a User, but the information I need is from UserTeam which holds the teams for the users.
'memberOfTeams' => array(self::MANY_MANY, 'UsersTeam', '{{teamMembers}}(userId, teamId)'),
'coachOfTeams' => array(self::HAS_MANY, 'UsersTeam', 'coachId'),