Using base controller and passing data to view

Hello there,

I’m using the base controller (components/controller.php) that I extend all my controllers from. I want to put some logic in there that is executed on all the controllers but is passed down to the view. Now the only way I know how to pass something to the view is with $this->render method, which won’t work, because it would be double rendering at times.

Any ideas? I just want to pass something to the view or have it accesible by the view without rendering.


On second thought, why do I even bother to open these threads because I have an answer I find for myself that works within the first 30 minutes… lol

What I did was made a public property at the top named list, then accessed the property via the view :)


public $list = array();


$this->list = array('item1','item2','item3');




Hope that helps somebody :)

Hi jwerd!

this thread is worthwhile !