I have a package that requires Google Map library. And I implemented it like this in the view.
<?php Yii::app()->clientScript->registerScriptFile('http://maps.googleapis.com/maps/api/js?sensor=false&language=' . Yii::app()->language . '®ion='.Yii::app()->language, CClientScript::POS_HEAD); ?>
<?php Yii::app()->clientScript->registerPackage('somelibrary'); ?>
(Note that the Google Map library needs a parameter Yii::app()->language).
But in the output, the package is always placed above the google maps.
<script type="text/javascript" src="/project/assets/74e60422/somelibrary.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=id&region=id"></script>
Is there any solution to make the Google Maps library as the package dependency? Or, at least, how to place the somelibrary package right after (not far below) the google maps ?
You can make the google map script a package itself by configuring the packages property of CClientScript.
Then you can add the googlemap to your packages dependencies by configuring ‘depends’ in the package configuration. This should then add the scripts in the correct order.
To add a package you can do the following (didn’t try that, but should work):
Same
'googleMap'=>array(/*...*/)will work when you put it in your configuration.