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-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
11 *
12 * Licensed under the Creative Commons BY-NC-SA 3.0 License
13 * Redistributions of files must retain the above copyright notice.
14 *
15 * @copyright Copyright 2005-2012, 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 Creative Commons BY-NC-SA 3.0 License (http://creativecommons.org/licenses/by-nc-sa/3.0/)
20 */
21
22 App::uses('AppController', 'Controller');
23
24 /**
25 * Static content controller
26 *
27 * Override this controller by placing a copy in controllers directory of an application
28 *
29 * @package app.Controller
30 * @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
31 */
32 class PagesController extends AppController {
33
34 /**
35 * Controller name
36 *
37 * @var string
38 */
39 public $name = 'Pages';
40
41 /**
42 * This controller does not use a model
43 *
44 * @var array
45 */
46 public $uses = array();
47
48 /**
49 * @var array
50 */
51 public $helpers = array('TwitterBootstrap.TwitterBootstrap');
52
53 /**
54 * Displays a view
55 *
56 * @param mixed What page to display
57 * @return void
58 */
59 public function display() {
60 $path = func_get_args();
61
62 $count = count($path);
63 if (!$count) {
64 $this->redirect('/');
65 }
66 $page = $subpage = $title_for_layout = null;
67
68 if (!empty($path[0])) {
69 $page = $path[0];
70 }
71 if (!empty($path[1])) {
72 $subpage = $path[1];
73 }
74 if (!empty($path[$count - 1])) {
75 $title_for_layout = Inflector::humanize($path[$count - 1]);
76 }
77 $this->set(compact('page', 'subpage', 'title_for_layout'));
78 $this->render(implode('/', $path));
79 }
80 }
81