headScript()->appendFile has the same behaviour as
headScript()->prependFile from view
I ran into some problem. appendFile does not seem to work from the view.
It has the same behaviour if I change it to prependFile.
layout.phtml
<!doctype html>
<html lang="en" dir="ltr">
<head>
<?php
$this->headScript()->appendFile('http://code.jquery.com/ui/1.10.3/jquery-ui.js');
$this->headScript()->appendFile('/theme/javascripts/application.js');
$this->headScript()->appendFile('/js/own.js');
?>
</head>
<body>
<?php echo $this->layout()->content; ?>
<?php echo $this->headScript() ?>
</body>
</html>
index.phtml
<?php $this->headScript()->appendFile('/js/another.js') ?>
output
<!doctype html>
<html lang="en" dir="ltr">
<head>
</head>
<body>
<script type="text/javascript" src="/js/another.js"></script>
<script type="text/javascript"
src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript"
src="/theme/javascripts/application.js"></script>
<script type="text/javascript" src="/js/own.js"></script>
</body>
</html>
As you can see /js/another.js will be the first js. That's not what I
want, I want to put it as last. Anyone knows what's wrong ?
No comments:
Post a Comment