Tuesday, May 3, 2011

how can I set my home page

I'm trying to set home.ctp as my home page/landing page. But no matter
how I try I'm redirected to a different page(http://domain.com/
practitioners/login
). I'm not sure if I'm following the correct
procedure. see below the pagesController and routes.php
class PagesController extends AppController {

var $name = 'Pages';

var $helpers = array('Html');

var $uses = array();


function display() {
$path = func_get_args();

$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;

if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->render(implode('/', $path));
}

public function home(){
$this->set('title_for_layout', 'Practitioner's');
$this->layout = 'home2';
}
}
?>

Routes.php:

Router::connect('/', array('controller' => 'pages', 'action' =>
'display', 'home'));
Router::connect('/pages/*', array('controller' => 'pages', 'action'
=> 'display'));

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: