-- sprynmr <[email protected]> wrote (on Monday, 05 January 2009, 12:32 PM -0800): > I'm still learning more about the javascript integration through the > jquery xtra shipped with 1.7, but when I look at all the hoops you > have to jump through to do some basic things with javascript in the > "Zend" way... I just get the feeling its more trouble than its worth. > > The jquery plugin viewhelpers are nice... but do I really want my > javascript that tied in to my php? And for that matter do I want to > write a new view helper for every jquery plugin I develop (or use?) It > seems like its handicapping you a little bit, or at the very least > forcing you to do quite a bit of extra work to do anything advanced. > > I think I might go the way of dynamic javascript includes... where > controllers not only automatically render their associated view (via > name matching), but also include their associated javascript. This > would be great for javascript instantiation. Then you could also have > a library of reusable js that can be dynamically included via the > various classes you use in your view (identified by their matching > name). > > It really seems this jquery/zend integration is quite the opposite of > the jquery motto... write less, do more.
Caveat: I'm not a jquery user, though I did review and provide feedback to Ben as he wrote the integration. With Dojo, at least, there are some clear benefits: Dojo is modular, and the view helpers and form elements help ensure that the appropriate dojo.require statements are created. This will help in the future, too, as we create functionality to create on-the-fly layer scripts for use with dojo. This is similiar to the iea of dynamic javascript includes you reference (as is the dojo.require functionality, actually). However, there's one place where it could be cleaner, and you touched on it with the jquery support: what about when you want to use a UI element that does not currently have a helper associated with it? Perhaps a generic helper that provides some basic scaffolding would help. That said, probably the most benefits to JS/ZF integration come when *prototyping*. I've found that as I've worked on the pastebin and bug demos that the integration helps get an initial UI ready, but that after I get the basics hammered out, I move it all to dedicated JS layers. The two places I tend to *keep* the integration are (1) for the scaffolding (generating the script and style tags and dynamic includes), and (2) forms (this is where integration shines, as you can have the UI defined in the same place you're defining the rules). Otherwise, I think you're correct -- such integration can only take you so far before it's more cumbersome than simply using the appropriate JS framework. -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
