In my controller, I usually do:
$this->view->foo = "bar";
(I call this vars, as VIEW-VARS)
In view script, I render this with:
echo $this->foo;
So, I wonder if it’s possible to define “view vars” inside models(not in controllers) that can be rendered in the view scripts.
Assigning information to the view is the job of the controller, and doing what you’re suggesting would muddy the boundaries of the MVC pattern.
What you should really be doing is assigning the model to the view (in the controller), and then access the various parts of the model within the view. Alternatively, you can assign only the relevant parts of the model in your controller.