One issue that I'm having, is that if a script is included in the default 
layout in the HEAD tag above the $scripts_for_layout, with the default 'inline' 
=> true, and then again in a view (or element, or whatever) with 'inline' 
=> false, The HtmlHelper does not recognize that the script in question has 
already been loaded, and proceeds to load another version of it.

This is troublesome, and doubly so for scripts like jQuery, where if it 
gets loaded again, it loses all previously loaded plugins.

How can I stop Cake from loading already loaded scripts that were loaded 
directly in the header of the layout?

Is this a bug?  Or deliberate?

I've tried a few things to fix this without editing core files, but they 
all have their various issues.

   1. Setting 'inline' => false on scripts loaded in the views, the scripts 
   that should have been loaded via the layout template (which have 'inline' 
   => true) get moved down in the queue, setting jQuery below some of it's 
   plugins (which only get loaded in the layout, therefore don't get moved 
   down, and get loaded inline as expected).
   2. Setting all scripts in the layout to 'inline' => false, seems to lose 
   all scripts that are added in the layout template. Only loading scripts 
   that were added in the views. Not sure why.
   3. Setting 'once' => false on the layout scripts, then the view 
   instances of the scripts get loaded as well.  It seems that 'once' => 
   false bypasses the storage of the script name into the 
__includedScriptsarray.

Any other methods for getting this to work as I'm expecting?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to