Zend Framework: how to specify a specific order in javascript files and scripts

I have the following javascript files included in the layout:

$this->InlineScript()->appendFile($this->baseUrl('resource/js/jquery.js')); $this->InlineScript()->appendFile($this->baseUrl('resource/js/main/login.js')); $this->InlineScript()->offsetSetFile(3,$this->baseUrl('resource/js/core.js')); 

I have the following script file in a file:

 <?php $this->InlineScript()->captureStart() ?> alert('This is Inline Script in View'); <?php $this->InlineScript()->captureEnd() ?> 

Right now, my script file in the view is pasting all javascript files.

How can I insert my inline script before 'core.js' and after the file 'login.js'

+4
source share
1 answer

in the layout you can use combinations of appendFile () and prependFile () if you have space for the file ...

and...

in "layout.phtml":

 <?php echo $this->inlineScript(); ?> 

in "test.phtml":

 <?php $this->inlineScript()->captureStart() ?> alert('This is Inline Script in View'); <?php $this->inlineScript()->captureEnd() ?> 

result:

 <html> <head> <script type="text/javascript"> //<!-- alert('This is Inline Script in View'); //--> </script> </head> 
+3
source

All Articles