Extending CHtml Error..

I need to exetend CHtml.




class THtml extends CHtml {


protected static $_model;


public function __construct($model){

  self::$_model = $model;

}


public static function activeLabel($attribtues,$htmlOptions = array()){

  return parent::activeLabel(self::$_model,$attributes,$htmlOptions);

}




}




but this code resulting an error.

Why I need to extend CHtml? because I need to hide $model variable.

so the user can edit their template using via smarty


{$THtml->activeLabel("attributeName")}

it is possible to extend CHtml?

same function parameters is a prerequisite to class extends

You mispelled $attribtues.

Is not needed to use the same parameter for extending a class, you have just to be sure to properly call the parent implementation.

If you are creating this kind of class, is better to delcare $_model and all method not static, because you are relaying of the content of the object THtml (even if it is working propery).

So your THtml can look like:




class THtml extends CHtml {


protected $_model;


public function __construct($model){

  $this->_model = $model;

}


public function activeLabel($attribtues,$htmlOptions = array()){

  return parent::activeLabel($this->_model,$attribtues,$htmlOptions);

}




}



Is working even with static declaration, but is not polite because a static method is expceted to work properly even if the class is not instantiated, whyle in your case is not possible to call THtml::activeLabel($attribtues).

(but for how you are using it, it is working properly as soon as you will correct the mispelled variable)