Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Controller define actions
- */
- <?php
- class Examplecontroller extends Controller
- {
- ....
- public function actions()
- {
- return array(
- 'member'=>array(
- 'class'=>'Ka',
- 'model' =>'Members',
- ),
- 'jobs'=>array(
- 'class'=>'Ka',
- 'model'=>'Projects',
- )
- );
- }
- ...
- /**
- * CAction in components folder
- */
- class Ka extends CAction
- {
- public $model = null;
- public function run( $getParam = null)
- {
- if($this->model === null)
- throw CException('Set Model name');
- $dp = new CActiveDataProvider($this->model);
- $this->controller->renderJson($dp->getData());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement