简体   繁体   中英

zend load js file order

I include my jquery.js in layout.phtml,

  <?php $this->headScript()->appendFile($this->baseUrl('js/jquery-1.7.2.min.js')); ?>
  <?= $this->headScript() ?>

and I include my own test.js in the IndexController,

$this->view->headScript()->appendFile('js/test.js');

but zend load the test.js file first, how could I make zend load jquery first ? because I used query code in test.js file.

You could do this by using "offsetSetFile(order, file)".

$this->view->headScript()->offsetSetFile(10, $this->baseUrl('js/jquery-1.7.2.min.js'));
$this->view->headScript()->offsetSetFile(20, $this->baseUrl('js/test.js'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM