Hi all,
I need your help once more
In multiple views of my application (register/edit/search) I need several dropdowns with colors and sizes. And I would like to reuse the data array I create. They don’t come from a database.
But I’m not sure on which is the best way to access these arrays:
-
call a method of my controller from the view which returns the array
-
call the method in my controller and assign it to the view
-
use a widget
-
use a partial
-
others?
To maintain the MVC pattern I probably should assign those in my controller. But this means I need to assign 5-10 arrays to my view on every action I need them.
And if I request them from the view, would this be ok?
public function getEyeColors()
{
return array(
false => 'Bitte wählen...',
'brown' => 'brown',
'green' => 'green',
);
}
What’s best practice, what do you use?
Regards,
ycast