Yeah, there is no error this time and my application works fine. After I compare two HTML before/after enabling this extension, only one line differs. Is it expected?
Normally the above will add about 6 Javascript tags to your head section after calling render().
Without changing the above code, using ExtendedClientScript will automatically combine these files to one, and compress them with JSMin. After that you will have only one Javascript tag rendered in your head section.
This saves 5 HTTP roundtrips from client to server, and reduces the amount of data transferred to the client. This will give your pages a more responsive feel, and saves you a lot of data transfer on top.
Same goes for your CSS files registered with registerCssFile() (or registerCoreScript()). All separate CSS files will be combined, and CSSTidy will compress and correct your CSS.
For CSS files with relative url's (like jQuery UI themes) you need to convert the url's to be a relative to root url. I might add an additional routine to automatically convert the relative url's in a later version.
Thank you again for a nice extension. I have changed my application that can be acquired from the google code using your ExtendedClientScirpt extension. Karma++
BTW, when I tried to generate a module using a shell command such as '…/…/framework/yiic shell' under the application directory, I got an error as below.
Quote
<h1>PHP Error</h1>
<h3>Description</h3>
<p class="message">
filemtime(): stat failed for /assets/8e71a30/jquery.js</p>
Actually when I turned ExtendedClientScript configuration OFF in the config/main.php, there is no error. Does this error come from the ExtendedClientScript?
First off, thanks Maxximus for the great extension.
I made some slight modifications to support themes a little, with a sort of cascading file system. I'm not sure that this is the right place to do this, or even if its the "correct" way of doing it, as I have only been using Yii for a few days. I just figured I would share my code in the hopes that someone else finds it useful, or could point out its flaws.
Change in combineAndCompress:
Total combinAndCompress function:
What this does is allow you do use something like:
and it will use /assets/css/admin/main.css by default, but if a theme is enabled, and the file /themes/THEMENAME/assets/css/admin/main.css exists it will used the theme version instead.
First of all, you can (will) run into some issues with JUI, especially when used with ThemeRoller themes, because of the relative paths used there.
For your current issue: It seems something goes wrong with the determination of the following: realpath($_SERVER['DOCUMENT_ROOT']). For one reason or another your $_SERVER['DOCUMENT_ROOT'] is still the default /var/www/.
Besides that, I doubt that the use of relative filepaths (~metayii/) will work as expected. Could you please try to set basePath to the correct absolute path (/home/metayii/Desarrollo/YII/yii-svn/demos/helloworld2/) in main.php, and see if things work as expected?
I think it might be advantageous to be able to choose to compress CSS or JS files separately, so you don't run into issues with relative paths in CSS but you still want to compile and compress your published JS scripts into one file.