controller.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * This is the template for generating a controller class file.
  4. * The following variables are available in this template:
  5. * - $className: the class name of the controller
  6. * - $actions: a list of action names for the controller
  7. */
  8. ?>
  9. <?php echo "<?php\n"; ?>
  10. class <?php echo $className; ?> extends Controller
  11. {
  12. <?php foreach($actions as $action): ?>
  13. public function action<?php echo ucfirst($action); ?>()
  14. {
  15. $this->render('<?php echo $action; ?>');
  16. }
  17. <?php endforeach; ?>
  18. // -----------------------------------------------------------
  19. // Uncomment the following methods and override them if needed
  20. /*
  21. public function filters()
  22. {
  23. // return the filter configuration for this controller, e.g.:
  24. return array(
  25. 'inlineFilterName',
  26. array(
  27. 'class'=>'path.to.FilterClass',
  28. 'propertyName'=>'propertyValue',
  29. ),
  30. );
  31. }
  32. public function actions()
  33. {
  34. // return external action classes, e.g.:
  35. return array(
  36. 'action1'=>'path.to.ActionClass',
  37. 'action2'=>array(
  38. 'class'=>'path.to.AnotherActionClass',
  39. 'propertyName'=>'propertyValue',
  40. ),
  41. );
  42. }
  43. */
  44. }