[Solar-talk] $this->output Discussion
Antti Holvikari
anttih at gmail.com
Wed Sep 12 12:23:09 CDT 2007
On 9/12/07, Raymond Kolbe <rkolbe at gmail.com> wrote:
> Hey all,
> So I find it a pain (well not really a PAIN but more...inconvenient)
> to have to declare all of my public data members for each view that I
> want to use. For example, if I have 5 or 10 different variables I need
> to output (I am not sure when I would have THIS many, but work with
> me...) I would have to declare each `public` in my class...not a big
> deal, but I think a more streamlined way would be nice...
>
> Such as...you would just call `get()` or `set()` to do just that...get
> and set your data members.
>
> As I am writing this I am starting to think it would not be a great
> idea since you should never have to declare a lot of data members for
> output anyways. Most of the text/data that you would want to output
> would probably come from other objects.
>
> Anyways, here is what I came up with (straight forward) and I think I
> might implement it in one of my projects. Let me know what you all
> think -- pros? cons?
>
> http://pastebin.com/m4ac35c79
Solar_View has a method assign() which it uses to assign variables.
You can use it in your controllers like this:
$this->_view_object->assign('var', 'value');
Hope that helps a bit.
--
Antti Holvikari
More information about the Solar-talk
mailing list