Advice about ViewHelpers and "app widgets"

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Advice about ViewHelpers and "app widgets"

Rodrigo Moraes
I've started to work on my little Zend Framework app this weekend. I
don't have much knowledge/experience with MVC and so... I have doubts
and need some advice. :-) I'll start with some ViewHelpers concerns.

- Are ViewHelpers a recommended way have "widgets" available
everywhere within the application? I've created helper functions to
build a custom widget, passing some parameters (or an array of
options). For example, a "News Widget" built by
Zend_View_Helper_NewsScroller is reasonable or a bad idea? The helper
talks to the News model to grab some data and display it according to
the defined options.

- I don't like the idea of more than one view instance within the
application - in my experience this leads to all kind of troubles.
Since I need a view object to display a "widget" (and supposing that
using ViewHelpers to build the widget is not a bad idea), am I in the
right path passing the main view instance by reference to the helper?

- Wouldn't it make sense to have methods like getScriptPath() or
removeScriptPath() to allow manipulation of the path stack? The stack
is private and you can't unset a path once it was used (in my case, by
the widget) and it is no longer needed. I thought that removing a path
could avoid future conflicts with script names.

I hope these doubts are clear enough. Any feedback would be very appreciated.

rodrigo moraes / brazil