Mercurial > hg > Members > shoshi > webvirt
comparison cake/console/templates/skel/controllers/pages_controller.php @ 0:261e66bd5a0c
hg init
author | Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 24 Jul 2011 21:08:31 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:261e66bd5a0c |
---|---|
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 /** | |
24 * Static content controller | |
25 * | |
26 * Override this controller by placing a copy in controllers directory of an application | |
27 * | |
28 * @package cake | |
29 * @subpackage cake.cake.libs.controller | |
30 */ | |
31 class PagesController extends AppController { | |
32 | |
33 /** | |
34 * Controller name | |
35 * | |
36 * @var string | |
37 * @access public | |
38 */ | |
39 var $name = 'Pages'; | |
40 | |
41 /** | |
42 * Default helper | |
43 * | |
44 * @var array | |
45 * @access public | |
46 */ | |
47 var $helpers = array('Html'); | |
48 | |
49 /** | |
50 * This controller does not use a model | |
51 * | |
52 * @var array | |
53 * @access public | |
54 */ | |
55 var $uses = array(); | |
56 | |
57 /** | |
58 * Displays a view | |
59 * | |
60 * @param mixed What page to display | |
61 * @access public | |
62 */ | |
63 function display() { | |
64 $path = func_get_args(); | |
65 | |
66 $count = count($path); | |
67 if (!$count) { | |
68 $this->redirect('/'); | |
69 } | |
70 $page = $subpage = $title_for_layout = null; | |
71 | |
72 if (!empty($path[0])) { | |
73 $page = $path[0]; | |
74 } | |
75 if (!empty($path[1])) { | |
76 $subpage = $path[1]; | |
77 } | |
78 if (!empty($path[$count - 1])) { | |
79 $title_for_layout = Inflector::humanize($path[$count - 1]); | |
80 } | |
81 $this->set(compact('page', 'subpage', 'title_for_layout')); | |
82 $this->render(implode('/', $path)); | |
83 } | |
84 } |