I am trying to have a listbox showing the friends a specific user has. However, i want each listbox item to show not only the name of the friend, but a thumbnail sized picture.. How could I implement this? I have been searching for some kind of item template option, but no luck. I also searched for a special htmlOption that could be used, but couldnt find one in the source code. Right now, my code only shows the names:
echo CHtml::listBox('listOfFriends_id','',
CHtml::listData($model->friends, 'id', 'name'),
array('onclick'=>'SelectedPosition()'));
Thank you!!
You can use a
CListViewto fully customize the HTML for your list. To make it show a drop down menu, you would:tagNametoselectitemsTagNametooptionenableSortingtofalseenablePaginationtofalsetemplateto"{items}"I ‘m probably forgetting a few more other variables you need to tweak, but the idea is that
CListViewprovides total customization of the HTML for the list so you can get it to make a drop down.