Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RblocksController extends Controller{
- //...
- public function actions(){
- // return external action classes, e.g.:
- return array(
- 'links'=>$this->getModule()->id.'.controllers.'.$this->id.'.linksActions',
- );
- }
- }
- class LinksActions extends CAction{
- public function run(){
- $r = yii::app()->getUrlManager()->parseUrl(yii::app()->getRequest());
- $controller = $this->getController()->getId().'/'.$this->id;
- $r = trim(substr($r,strpos($r,$controller)+strlen($controller)),'/');
- $path = explode('/', $r);
- $action = $path[0]?:'index';
- if (yii::app()->request->getIsPostRequest() && method_exists($this, $action.'Post')){
- $action .= 'Post';
- }elseif (!method_exists($this, $action)){
- $this->getController()->missingAction($action);
- }
- $this->$action();
- }
- public function index(){
- $model = MangaLinks::model()->findAll();
- $this->getController()->render('links',array('model'=>$model));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment