I have following javascript files included in 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 following script in view file:
<?php $this->InlineScript()->captureStart() ?>
alert('This is Inline Script in View');
<?php $this->InlineScrip开发者_开发知识库t()->captureEnd() ?>
Right now, my script in view file, is inserting before all javascript files.
How can I insert my inline script before 'core.js' and after 'login.js' file
in layout you can used appendFile() and prependFile() combinations,if you will have some place for 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>
精彩评论