source: Dev/branches/cakephp/app/controllers/pages_controller.php @ 126

Last change on this file since 126 was 126, checked in by fpvanagthoven, 14 years ago

Cakephp branch.

File size: 2.2 KB
Line 
1<?php
2
3/**
4 * Static content controller.
5 *
6 * This file will render views from views/pages/
7 *
8 * PHP versions 4 and 5
9 *
10 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
11 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
12 *
13 * Licensed under The MIT License
14 * Redistributions of files must retain the above copyright notice.
15 *
16 * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
17 * @link          http://cakephp.org CakePHP(tm) Project
18 * @package       cake
19 * @subpackage    cake.cake.libs.controller
20 * @since         CakePHP(tm) v 0.2.9
21 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
22 */
23
24/**
25 * Static content controller
26 *
27 * Override this controller by placing a copy in controllers directory of an application
28 *
29 * @package       cake
30 * @subpackage    cake.cake.libs.controller
31 * @link http://book.cakephp.org/view/958/The-Pages-Controller
32 */
33class PagesController extends AppController {
34
35    /**
36     * Controller name
37     *
38     * @var string
39     * @access public
40     */
41    var $name = 'Pages';
42    /**
43     * Default helper
44     *
45     * @var array
46     * @access public
47     */
48    var $helpers = array('Html', 'Session');
49    /**
50     *
51     * @var HtmlHelper
52     */
53    var $Html;
54    /**
55     * This controller does not use a model
56     *
57     * @var array
58     * @access public
59     */
60    var $uses = array();
61
62    /**
63     * Displays a view
64     *
65     * @param mixed What page to display
66     * @access public
67     */
68    function display() {
69        $path = func_get_args();
70
71        $count = count($path);
72        if (!$count) {
73            $this->redirect('/');
74        }
75        $page = $subpage = $title_for_layout = null;
76
77        if (!empty($path[0])) {
78            $page = $path[0];
79        }
80        if (!empty($path[1])) {
81            $subpage = $path[1];
82        }
83        if (!empty($path[$count - 1])) {
84            $title_for_layout = Inflector::humanize($path[$count - 1]);
85        }
86        $this->set(compact('page', 'subpage', 'title_for_layout'));
87        $this->render(implode('/', $path));
88    }
89
90    function home() {
91       
92    }
93
94}
Note: See TracBrowser for help on using the repository browser.