pages_controller.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: libs_2controller_2pages__controller_8php-source.html 675 2008-12-26 00:27:14Z gwoo $ */
00003 
00004 /**
00005  * Short description for file.
00006  *
00007  * This file is application-wide controller file. You can put all
00008  * application-wide controller-related methods here.
00009  *
00010  * PHP versions 4 and 5
00011  *
00012  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
00013  * Copyright 2005-2008, Cake Software Foundation, Inc.
00014  *                              1785 E. Sahara Avenue, Suite 490-204
00015  *                              Las Vegas, Nevada 89104
00016  *
00017  * Licensed under The MIT License
00018  * Redistributions of files must retain the above copyright notice.
00019  *
00020  * @filesource
00021  * @copyright       Copyright 2005-2008, Cake Software Foundation, Inc.
00022  * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
00023  * @package         cake
00024  * @subpackage      cake.cake.libs.controller
00025  * @since           CakePHP(tm) v 0.2.9
00026  * @version         $Revision: 675 $
00027  * @modifiedby      $LastChangedBy: gwoo $
00028  * @lastmodified    $Date: 2008-12-25 16:27:14 -0800 (Thu, 25 Dec 2008) $
00029  * @license         http://www.opensource.org/licenses/mit-license.php The MIT License
00030  */
00031 
00032 /**
00033  * Short description for class.
00034  *
00035  * This file is application-wide controller file. You can put all
00036  * application-wide controller-related methods here.
00037  *
00038  * Add your application-wide methods in the class below, your controllers
00039  * will inherit them.
00040  *
00041  * @package     cake
00042  * @subpackage  cake.cake.libs.controller
00043  */
00044 class PagesController extends AppController{
00045 
00046 /**
00047  * Enter description here...
00048  *
00049  * @var unknown_type
00050  */
00051      var $name = 'Pages';
00052 
00053 /**
00054  * Enter description here...
00055  *
00056  * @var unknown_type
00057  */
00058      var $helpers = array('Html');
00059 
00060 /**
00061  * This controller does not use a model
00062  *
00063  * @var $uses
00064  */
00065      var $uses = array();
00066 
00067 /**
00068  * Displays a view
00069  *
00070  */
00071      function display() {
00072           if (!func_num_args()) {
00073                 $this->redirect('/');
00074           }
00075 
00076           $path=func_get_args();
00077 
00078           if (!count($path)) {
00079                 $this->redirect('/');
00080           }
00081 
00082           $count  =count($path);
00083           $page   =null;
00084           $subpage=null;
00085           $title  =null;
00086 
00087           if (!empty($path[0])) {
00088                 $page = $path[0];
00089           }
00090 
00091           if (!empty($path[1])) {
00092                 $subpage = $path[1];
00093           }
00094 
00095           if (!empty($path[$count - 1])) {
00096                 $title = ucfirst($path[$count - 1]);
00097           }
00098 
00099           $this->set('page', $page);
00100           $this->set('subpage', $subpage);
00101           $this->set('title', $title);
00102           $this->render(join('/', $path));
00103      }
00104 }
00105 ?>