Hello Jurian

Thank you very much for your comments. At the moment, I am still
playing with (read: learning) ZF2 for dummy projects. I hope that by
the time the first RC comes our, I can start think about using it for
client work.

> In your approach you always need to use $this->view for
> returning a view object.

I agree, this is a significant disadvantage.

> For very simple parameter injection I'd go with the
> Module.php listener approach.

I will code the same functionality using this approach. And then
compare them side-by-side.

> If you have more complex variables required in
> your view script, you could write a view helper
> for that. Your uri parameters is an excellent
> example for that imho.

I agree with you here too.

There are many ways to skin a cat. At the moment, I trying to find
them, so I can make an informed decision about which one is most
suitable to my applications.

Again, thanks for your feedback.

Jonathan Maron





On Sat, May 26, 2012 at 10:00 AM, Jurian Sluiman
<[email protected]> wrote:
> Hi Jonathan,
>
> 2012/5/26 Jonathan Maron <[email protected]>
>>
>> Hello Roman
>>
>> I have asked myself the same question: How can I pass basic, standard
>> variables to the View that should be available on every section of the
>> module. I your case, you just want the names of controller and action
>> in the View. I also want some more standard variables (locale, uri
>> etc).
>>
>> I have come up with a solution that involves a custom
>> \Zend\Mvc\Controller\ActionController that is then used by the
>> Controllers.
>>
>> Please take a look at this solution:
>>
>> https://gist.github.com/2792133
>>
>> I am looking at your solution right now.
>>
>> What are the advantages of these two approaches?
>>
>> Jonathan Maron
>
>
> In your approach you always need to use $this->view for returning a view
> object. If you use another module from someone else, s/he probably isn't
> using your own action controller, so there you don't have those variables.
>
> For very simple parameter injection I'd go with the Module.php listener
> approach. It's independent from whatever you do with your controllers and
> thus much safer. Keep in mind this can go wrong for perhaps CLI requests or
> http requests which do not use the PhpRenderer but instead return a JSON
> response.
>
> If you have more complex variables required in your view script, you could
> write a view helper for that. Your uri parameters is an excellent example
> for that imho.
> --
> Jurian Sluiman

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to