Including jQuery and JUI

I have a slight issue with regards to including jQuery and jQueryUI.

Instead of Yii widgets/extensions auto-including jQuery files I want to include these files manually (using my own versions) so that they are always available.

This is how I’ve configured it in my main.php layout file:










The problem I’m having at the moment is that ‘jquery-ui-1.7.2.custom.min.js’ is being added last. I am using a widget which registers a script file and this file depends on jQueryUI and therefore needs to be added after ‘jquery-ui-1.7.2.custom.min.js’.

So how do I get the two jQuery files to be included together, and all other additional scripts to be added at the end?

Anybody have any suggestions for this?

If it is always going to be needed you could just add it to the layout file as html.

Ah yes, you’re right. So I basically add the scripts in using CHtml::scriptFile() and then do:




to prevent Yii from loading it’s own jQuery file.

registerScriptFile() method

public void registerScriptFile(string $url, integer $position=0)

$url string URL of the javascript file

$position integer the position of the JavaScript code. Valid values include the following:

* CClientScript::POS_HEAD : the script is inserted in the head section right before the title element.

* CClientScript::POS_BEGIN : the script is inserted at the beginning of the body section.

* CClientScript::POS_END : the script is inserted at the end of the body section.

Plus more position for them.

daonhack - I was talking about the positioning of the scripts within the HEAD section, not within the document.

Plus more

'jquery.min.js'=>false,	//if you disabled YII_DEBUG <img src='' class='bbc_emoticon' alt=':)' />