Cleaning up PagesController, fixes #4640

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6871 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-05-14 21:34:26 +00:00
parent 18b627636b
commit b489bb1470
2 changed files with 8 additions and 20 deletions

View file

@ -34,7 +34,7 @@
* @package cake
* @subpackage cake.cake.libs.controller
*/
class PagesController extends AppController{
class PagesController extends AppController {
/**
* Controller name
*
@ -63,18 +63,13 @@ class PagesController extends AppController{
* @access public
*/
function display() {
if (!func_num_args()) {
$this->redirect('/');
}
$path = func_get_args();
if (!count($path)) {
$this->redirect('/');
}
$count = count($path);
$page = null;
$subpage = null;
$title = null;
$page = $subpage = $title = null;
if (!empty($path[0])) {
$page = $path[0];
@ -85,10 +80,9 @@ class PagesController extends AppController{
if (!empty($path[$count - 1])) {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set('page', $page);
$this->set('subpage', $subpage);
$this->set('title', $title);
$this->set(compact('page', 'subpage', 'title'));
$this->render(join('/', $path));
}
}
?>

View file

@ -34,7 +34,7 @@
* @package cake
* @subpackage cake.cake.libs.controller
*/
class PagesController extends AppController{
class PagesController extends AppController {
/**
* Controller name
*
@ -63,18 +63,13 @@ class PagesController extends AppController{
* @access public
*/
function display() {
if (!func_num_args()) {
$this->redirect('/');
}
$path = func_get_args();
if (!count($path)) {
$this->redirect('/');
}
$count = count($path);
$page = null;
$subpage = null;
$title = null;
$page = $subpage = $title = null;
if (!empty($path[0])) {
$page = $path[0];
@ -85,10 +80,9 @@ class PagesController extends AppController{
if (!empty($path[$count - 1])) {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set('page', $page);
$this->set('subpage', $subpage);
$this->set('title', $title);
$this->set(compact('page', 'subpage', 'title'));
$this->render(join('/', $path));
}
}
?>