ruzz on symfony
reasons to loathe textmate #1
textmate, so far as i can see, only gets praise.
i ask you, looking at the above image if that seems like an at all useful sidebar tray when working with projects?
uhm. no.
i wonder how the ease, or lack thereof, of finding the right file (you do abstract into partials right?) impacts overall enjoyment while programming. we work with files all day long, lots of them, and if you are only micro-annoyed by the interface and tools for dealing with them that has to add up to something.
maybe thats why i’ve been working more and more on my pc lately.
or, maybe it’s the codecomplete offered by Zend IDE which apparently is beyond the ken of mac programmers..
simple. clear. focused, and it works.
i love tightly targeted apps.
symfony js include order
you know how you can’t control the order of the js file inclusions in the head portion of your web pages when you build them with symfony?
ever tried to use some of the third party js libraries to do cool stuff and struggle with basic implementation because they depend on prototype—which means prototype needs to be included before the addon library—and thought ‘man, this sucks balls’.
me too.
so I went digging on the web for known fixes and and/or just general talk about the problem. What I found was:
#313 (Javascriptwhich if you follow the ticket suggests it’s fixed. If you follow through to the forum talk about it, they say it’s been fixed.
either i’m doing something wrong or they are because if i add prototip to my app view.yml file, it turns up as the first thing added, before prototype, and this remains true regardless of how you choose to play this ordering game.
i found some discussion before, which i’ve since lost track of, which pointed to the Javascript helper as the culrpit and i’m inclined to agree. I wouldn’t say i fully follow the symfony stack, but i can say from my own testing that regardless what order i put things in they get reordered and looking at the hodge podge of addJavascript calls i get the impression this happens in the stack somewhere after i’ve declared my order.
in any case, the net result is that i can’t seem to get the js files included in the order i need them to be… so i went digging deeper.
after wandering through the symfony innards i discovered where the js inclusions are stored, and if you monkey with them in the controller (action) they generally come out right.
here’s how you can set the order yourself:
sfContext::getInstance()->getResponse()->setParameter(‘/js/prototip.js’, ‘/js/prototip.js’, ‘helper/asset/auto/javascript’);
the list of js files (with pathing) are kept in a parameter holder at /helper/asset/auto/javascript so you can just add files you want included to this holder in the order you want them added.
for example if you want to add prototype, then effects, then prototip you would need three of the above lines in that order.
as an aside, to check what order they are going to be spit out in you can call:
$x= sfContext::getInstance()->getResponse()->getJavascripts();
print_r($x);
which should give you a nice print out of the js includes and their order. like this:
from there you can order at will. my suggestion is to copy the existing order and then add the files you want, where you want them.
i have to say this is a total hack. it’s vulnerable to changes in the system, and i’m not sure i would want a hack like this laying around in my controller (possibly more than once) just waiting for something to change in symfony for it to explode and break my app.. but and this is a big but sometimes you just have to get shit done and hacks exist for a reason..
in this case, it was so i could have the really cool prototype based tool tips offered by prototip.
but you have to decide for yourself if there is anything worth the run and gun nature of this solution.. or, perhaps you have more time than me and can think of a pretty way of handling this so we don’t leave our asses uncovered..
testing out jing.
more: http://www.jingproject.com/
mm. no worky quite how i would think it would work.
& search is everything. ruzz


