PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/Cake/Console/Templates/skel/Controller/PagesController.php

https://bitbucket.org/udeshika/fake_twitter
PHP | 78 lines | 25 code | 7 blank | 46 comment | 4 complexity | 77f1f16bc65de2e5ad57d500e0d0c821 MD5 | raw file
  1. <?php
  2. /**
  3. * Static content controller.
  4. *
  5. * This file will render views from views/pages/
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  10. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package app.Controller
  18. * @since CakePHP(tm) v 0.2.9
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. /**
  22. * Static content controller
  23. *
  24. * Override this controller by placing a copy in controllers directory of an application
  25. *
  26. * @package app.Controller
  27. */
  28. class PagesController extends AppController {
  29. /**
  30. * Controller name
  31. *
  32. * @var string
  33. */
  34. public $name = 'Pages';
  35. /**
  36. * Default helper
  37. *
  38. * @var array
  39. */
  40. public $helpers = array('Html');
  41. /**
  42. * This controller does not use a model
  43. *
  44. * @var array
  45. */
  46. public $uses = array();
  47. /**
  48. * Displays a view
  49. *
  50. * @param mixed What page to display
  51. */
  52. public function display() {
  53. $path = func_get_args();
  54. $count = count($path);
  55. if (!$count) {
  56. $this->redirect('/');
  57. }
  58. $page = $subpage = $title_for_layout = null;
  59. if (!empty($path[0])) {
  60. $page = $path[0];
  61. }
  62. if (!empty($path[1])) {
  63. $subpage = $path[1];
  64. }
  65. if (!empty($path[$count - 1])) {
  66. $title_for_layout = Inflector::humanize($path[$count - 1]);
  67. }
  68. $this->set(compact('page', 'subpage', 'title_for_layout'));
  69. $this->render(implode('/', $path));
  70. }
  71. }