Zend Framework and Repeating Javascript Issue
May 28, 2008 Development, PHP, Zend Framework No CommentsWell, I finally was able to determine why multiple copies of my JavaScripts where showing up in Firebug. It appears that it boils down to a misunderstanding of when and how to use the headScript() method.
Apparently, this headScript(), headLink() and other methods seem to be really geared for inserting scripts at the controller/action level. Since I had them in my layout, they were repeating SEVERAL times and causing pretty poor performance as one would expect. Ahh, nothing like downloading the same files over and over and over…sheesh.
My solution and what seems to be the norm was to simply call the scripts from the layout statically. I just added a little inline PHP to get the baseUrl and poof! It worked like a champ.
Now on to more exciting stuff.