I want to transform a Prado application into Yii. At the moment I stuck at the TDatepicker. The Prado application uses it extensively. So I tried to create an CHtml-element with an integrated jnterface-datepicker, similar to the TDatepicker from Prado.
<?php
class EHTML extends CHTML
{
public static function activeDatePicker($model,$attribute,$htmlOptions=array())
{
self::resolveNameID($model,$attribute,$htmlOptions);
self::clientChange('change',$htmlOptions);
$html=self::activeInputField('text',$model,$attribute,$htmlOptions);
// THE WRONG COMMAND:
$this->widget('application.extensions.jnterface.datepicker', array('name'=>$model->$attribute));
return $html;
}
}
I know, that "$this->" is wrong, but what is the right way?
If you really want to encapsulate the widget call in a static method, you should refer to the implementation of CBaseController::widget() since you can't use $this in a static method.