PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/code/ryzom/tools/server/www/webtt/cake/libs/controller/pages_controller.php

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