You should absolutely not do that for two reasons:

- each extra HTTP request costs time. It is a lot faster to combine several JS files into one, because that then comes from the browser cache, and just one HEAD is made to the web server to see if it's up to date. - it's incredibly, incredibly hard to do in combination with caching. It's a bit too hard to explain without causing utter confusion, but trust me, you will regret it. It's not really an implementational problem in Agavi, but rather a general logical issue. In short: a slot that was cached on page A will be restored from cache on page B, and restore all of page A's javascript and css instructions. Fail. You can work around it, of course, but that's annoying.

My tip would be to do it based on routes or something, in a global filter.

- David



On 01.03.2009, at 08:53, Michal Charemza wrote:

Hi,

I tend to like having all the script tags for javascript together in
the head section (but I think some people like having them all at the
bottom of the body, so I guess this all applied to both). I would like
a slot to somehow be able to 'register' that it uses a script, so the
master template outputs all script  tags together.

I'm not sure of the best way to do this. One issue that I've come
across is that if a view is set to be a slot, then it doesn't seem to
have access to the variables in the master template (my first thought
was to call $this->setAttribute in the slot view, but this doesn't
seem to affect variables in the master template). I'm also also not
sure of the best place the code for this should be. Should it be in
the view? In the template? In a config file?

Michal.


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to