mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
18b627636b
commit
b489bb1470
2 changed files with 8 additions and 20 deletions
|
@ -63,18 +63,13 @@ class PagesController extends AppController{
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function display() {
|
function display() {
|
||||||
if (!func_num_args()) {
|
|
||||||
$this->redirect('/');
|
|
||||||
}
|
|
||||||
$path = func_get_args();
|
$path = func_get_args();
|
||||||
|
|
||||||
if (!count($path)) {
|
if (!count($path)) {
|
||||||
$this->redirect('/');
|
$this->redirect('/');
|
||||||
}
|
}
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
$page = null;
|
$page = $subpage = $title = null;
|
||||||
$subpage = null;
|
|
||||||
$title = null;
|
|
||||||
|
|
||||||
if (!empty($path[0])) {
|
if (!empty($path[0])) {
|
||||||
$page = $path[0];
|
$page = $path[0];
|
||||||
|
@ -85,10 +80,9 @@ class PagesController extends AppController{
|
||||||
if (!empty($path[$count - 1])) {
|
if (!empty($path[$count - 1])) {
|
||||||
$title = Inflector::humanize($path[$count - 1]);
|
$title = Inflector::humanize($path[$count - 1]);
|
||||||
}
|
}
|
||||||
$this->set('page', $page);
|
$this->set(compact('page', 'subpage', 'title'));
|
||||||
$this->set('subpage', $subpage);
|
|
||||||
$this->set('title', $title);
|
|
||||||
$this->render(join('/', $path));
|
$this->render(join('/', $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -63,18 +63,13 @@ class PagesController extends AppController{
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function display() {
|
function display() {
|
||||||
if (!func_num_args()) {
|
|
||||||
$this->redirect('/');
|
|
||||||
}
|
|
||||||
$path = func_get_args();
|
$path = func_get_args();
|
||||||
|
|
||||||
if (!count($path)) {
|
if (!count($path)) {
|
||||||
$this->redirect('/');
|
$this->redirect('/');
|
||||||
}
|
}
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
$page = null;
|
$page = $subpage = $title = null;
|
||||||
$subpage = null;
|
|
||||||
$title = null;
|
|
||||||
|
|
||||||
if (!empty($path[0])) {
|
if (!empty($path[0])) {
|
||||||
$page = $path[0];
|
$page = $path[0];
|
||||||
|
@ -85,10 +80,9 @@ class PagesController extends AppController{
|
||||||
if (!empty($path[$count - 1])) {
|
if (!empty($path[$count - 1])) {
|
||||||
$title = Inflector::humanize($path[$count - 1]);
|
$title = Inflector::humanize($path[$count - 1]);
|
||||||
}
|
}
|
||||||
$this->set('page', $page);
|
$this->set(compact('page', 'subpage', 'title'));
|
||||||
$this->set('subpage', $subpage);
|
|
||||||
$this->set('title', $title);
|
|
||||||
$this->render(join('/', $path));
|
$this->render(join('/', $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in a new issue