the site / forum search is down, so this question may have been asked before.
I’m currently working on a site where much of the content is rendered via ajax and renderPartial (also using jQuery Mobile). A user can sit through a full session on the site with only one full page load, which is login (there are a few others as well).
Now, let’s say I’m on a page, and I click a link. This link requests a new page (ajax, renderPartial) which uses CJuiSlider or similar. Yii would then do some calls to registerScript, and registerScriptFile (and maybe some to register CSS).
When a simple partial view with only a slider is returned (processOutput is enabled) the response is as follows (formatted):
Now, if you run the same action several times, these JS and CSS files will be returned every time. This includes jqueryUI and jquery as well. This seems lesst than ideal.
One option would be to manually include the script and CSS I know will be used in the initial page load, then blacklist them in scriptMap as follows:
'clientScript'=>array( 'class' => 'SClientScript', 'scriptMap'=>array( 'jquery.js'=>false, 'jquery.ui.js'=>false, 'jquery.yiiactiveform.js'=>false, ),
Now, what’s the best practice here? What would you do?