Inline views, write less

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

Sometimes writing views like


or something like this is too mainstream. Plus, sometimes we will need more than one ways to view models.

In this case I like below approach for my self. I often use slug so...

class MyModel extends CActiveRecord

public function url($options=array(),$defaultView='view')
   return array($defaultView,array('slug'=>$this->slug),$options);
   return array($defaultView,array('id'=>$this->id),$options);