00001 <?php 00002 /* SVN FILE: $Id: pages_controller.php 7805 2008-10-30 17:30:26Z AD7six $ */ 00003 /** 00004 * Static content controller. 00005 * 00006 * This file will render views from views/pages/ 00007 * 00008 * PHP versions 4 and 5 00009 * 00010 * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) 00011 * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) 00012 * 00013 * Licensed under The MIT License 00014 * Redistributions of files must retain the above copyright notice. 00015 * 00016 * @filesource 00017 * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) 00018 * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project 00019 * @package cake 00020 * @subpackage cake.cake.libs.controller 00021 * @since CakePHP(tm) v 0.2.9 00022 * @version $Revision: 7805 $ 00023 * @modifiedby $LastChangedBy: AD7six $ 00024 * @lastmodified $Date: 2008-10-30 13:30:26 -0400 (Thu, 30 Oct 2008) $ 00025 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 00026 */ 00027 /** 00028 * Static content controller 00029 * 00030 * Override this controller by placing a copy in controllers directory of an application 00031 * 00032 * @package cake 00033 * @subpackage cake.cake.libs.controller 00034 */ 00035 class PagesController extends AppController { 00036 /** 00037 * Controller name 00038 * 00039 * @var string 00040 * @access public 00041 */ 00042 var $name = 'Pages'; 00043 /** 00044 * Default helper 00045 * 00046 * @var array 00047 * @access public 00048 */ 00049 var $helpers = array('Html'); 00050 /** 00051 * This controller does not use a model 00052 * 00053 * @var array 00054 * @access public 00055 */ 00056 var $uses = array(); 00057 /** 00058 * Displays a view 00059 * 00060 * @param mixed What page to display 00061 * @access public 00062 */ 00063 function display() { 00064 $path = func_get_args(); 00065 00066 $count = count($path); 00067 if (!$count) { 00068 $this->redirect('/'); 00069 } 00070 $page = $subpage = $title = null; 00071 00072 if (!empty($path[0])) { 00073 $page = $path[0]; 00074 } 00075 if (!empty($path[1])) { 00076 $subpage = $path[1]; 00077 } 00078 if (!empty($path[$count - 1])) { 00079 $title = Inflector::humanize($path[$count - 1]); 00080 } 00081 $this->set(compact('page', 'subpage', 'title')); 00082 $this->render(join('/', $path)); 00083 } 00084 } 00085 00086 ?>
1.4.7