Multiple Data Objects from Controller to View


I was wondering how to pass and display multiple objects from the controller to the view…

Like if I wanted to send different types of objects to the view??

Hoping I’m asking this correctly…

Example (from another framework)

Controller —>

function index(){






(now in the view you could access the data like this…)

echo ($person->eye_color);

echo ($car->car_color);

echo (count($homes));

How might I do something like this in YII?

Many thanks,


Hi, Vance.

Just an FYI. This question should probably be in a different section. You might want to get started by reading through the Definitive Guide to Yii and later following the Blog Tutorial. The section describing what you’re asking is in: View: Definitive Guide to Yii