Thanks Sharma,
If you are interested to know any more details feel free to ask,
in general for front end I am using JQuery and Blueprint css.
I find gii module very helpful, thank you Yii.
However I had some issues with CClientScript, especially whit Ajax requests.
Here is a quick example:
Imagine you are using some of the JQuery plugins, in my case I am using Asual JQuery Address and I am of course registering that script on top of the layout file, here is simplified code:
<?php
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerPackage('address');
?>
<!DOCTYPE html>
<html>
<head>
<title>Simple Layout</title>
</head>
<body>
<div id="div-to-populate-with-ajax-response"></div>
</body>
</html>
And here is the example of a simple view page that needs to be populated:
<?php
echo $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'id' => 'date-widget',
'name' => 'date-widget',
'model' => $someModel,
// ...
));
?>
Now here is what happens, if we have this piece of code in controller (assume inline action):
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial('_datePicker', array(
'someModel' => $someModel,
));
}
Our date widget is not initialized (scripts are registered but output is not processed).
Of course we have option to use this code instead to trigger output processing:
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial('_datePicker', array(
'someModel' => $someModel,
), false, true);
}
But this is where problem exists, any widget that uses client script will register core scripts again,
and JQuery script will be included once more.
This newly included script file once loaded in browser will be evaluated and as a result "$ - jQuery"
object is completely new instance in memory and this time none of the JQuery plugins are available any longer.
I wonder if there is some decent solution for this problem, I had to use some nasty workarounds (manly inline scripts tags).
Oh, and by the way, any feedback or help is greatly appreciated, at the moment we are a little short on man power
(I do all the code + design).
Cheers