Can some one tell me how to incorporate a custom jquery script inside of yii?
Here is the one that I want to implement (2234
attached zip file to this ticket.)
I am a newbie and I don’t understand how to include custom scripts inside of yii…
If you know of a jquery scroller with XML file reading capable abilities that will install easily in yii, please let me know…
the exact solution depends on whether you need JS file included on all (or mostly all) pages of site or on just several ones:
- if former - include JS file in layout file, but notice that Yii includes bundled scripts (like jQuery) right before <title>-tag, so you better place you <script>-tag(s) after <title>-tag.
- if latter - then you might use CClientScript::registerScriptFile in you controller or view like this:
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/yourFile.js');
Ok That’s it?
Easy enough… I thought there was a specific structure with this framework…
afaik Yii does a replace on </head> and replaces it with [js files]</head> so it has nothing to do with title tag
So you can see that JS codes are being included before <title>-tag, but if no <title>-tag presented - then before </head>-tag.