Re: how can I set my home page
I've allowed the display action and it now works. Thanks for the help guys. On May 5, 3:46 pm, mi...@brightstorm.co.uk wrote: > > Yes I'm using the Auth component, and yes I've added the Auth > > component in my AppController. > > I'm new to CakePhp so this might sound like a stupid question > > > I added the home action on $this->Auth- > >>allow('index','view','recover','verify','home'); > > I thought this would solve the problem but its still asking me to log > > in. Please advice. > > if you are using the pages controller to display your home.ctp then you'll > need to allow the 'display' action rather than the page you are trying to > display. > > > > > > > > > this is my Appcontroller: > > > class AppController extends Controller { > > var $components = array('Auth','Session','Email'); > > //var $helpers = array('Time'); > > > function beforeFilter(){ > > $this->Auth->allow('index','view','recover','verify','home'); > > $this->Auth->userModel = 'Practitioner'; > > $this->Auth->fields = array('username' => 'email', 'password' => > > 'password'); > > $this->Auth->authError = 'To login please enter your email and > > password!'; > > $this->Auth->loginError = 'Incorect Email or password > > combination.'; > > $this->Session->write('Auth.redirect', null); > > $this->Auth->loginRedirect = array('controller' => > > 'Practitioners', > > 'action' => 'index'); > > $this->Auth->logoutRedirect = > > array(Configure::read('Routing.admin') > > => false, 'controller' => 'Practitioners', 'action' => 'logout'); > > $this->Model->authUserId = $this->Auth->user('id'); > > } > > } > > > Thanks in advance > > > On May 4, 10:56 am, Ryan Schmidt wrote: > >> On May 3, 2011, at 17:07, mthabisi mlunjwa wrote: > > >> > 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). > > >> Sounds like you've added the Auth component (possibly to your > >> AppController). Is that possible? If so, that's what's asking you to log > >> in here. > > >>http://book.cakephp.org/view/1250/Authentication > > >> If you don't want users to have to log in to see your home page, then > >> you need to tell the Auth component that, for example by allowing the > >> display action. (This will allow all URLs handled by the Pages > >> controller (not just the home page) to be displayed.) > > >>http://book.cakephp.org/view/1656/allowedActions > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how can I set my home page
> Yes I'm using the Auth component, and yes I've added the Auth > component in my AppController. > I'm new to CakePhp so this might sound like a stupid question > > I added the home action on $this->Auth- >>allow('index','view','recover','verify','home'); > I thought this would solve the problem but its still asking me to log > in. Please advice. if you are using the pages controller to display your home.ctp then you'll need to allow the 'display' action rather than the page you are trying to display. > this is my Appcontroller: > > class AppController extends Controller { > var $components = array('Auth','Session','Email'); > //var $helpers = array('Time'); > > > function beforeFilter(){ > $this->Auth->allow('index','view','recover','verify','home'); > $this->Auth->userModel = 'Practitioner'; > $this->Auth->fields = array('username' => 'email', 'password' => > 'password'); > $this->Auth->authError = 'To login please enter your email and > password!'; > $this->Auth->loginError = 'Incorect Email or password > combination.'; > $this->Session->write('Auth.redirect', null); > $this->Auth->loginRedirect = array('controller' => > 'Practitioners', > 'action' => 'index'); > $this->Auth->logoutRedirect = > array(Configure::read('Routing.admin') > => false, 'controller' => 'Practitioners', 'action' => 'logout'); > $this->Model->authUserId = $this->Auth->user('id'); > } > } > > Thanks in advance > > On May 4, 10:56 am, Ryan Schmidt wrote: >> On May 3, 2011, at 17:07, mthabisi mlunjwa wrote: >> >> > 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). >> >> Sounds like you've added the Auth component (possibly to your >> AppController). Is that possible? If so, that's what's asking you to log >> in here. >> >> http://book.cakephp.org/view/1250/Authentication >> >> If you don't want users to have to log in to see your home page, then >> you need to tell the Auth component that, for example by allowing the >> display action. (This will allow all URLs handled by the Pages >> controller (not just the home page) to be displayed.) >> >> http://book.cakephp.org/view/1656/allowedActions > > -- > 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+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > > -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how can I set my home page
Yes I'm using the Auth component, and yes I've added the Auth component in my AppController. I'm new to CakePhp so this might sound like a stupid question I added the home action on $this->Auth- >allow('index','view','recover','verify','home'); I thought this would solve the problem but its still asking me to log in. Please advice. this is my Appcontroller: class AppController extends Controller { var $components = array('Auth','Session','Email'); //var $helpers = array('Time'); function beforeFilter(){ $this->Auth->allow('index','view','recover','verify','home'); $this->Auth->userModel = 'Practitioner'; $this->Auth->fields = array('username' => 'email', 'password' => 'password'); $this->Auth->authError = 'To login please enter your email and password!'; $this->Auth->loginError = 'Incorect Email or password combination.'; $this->Session->write('Auth.redirect', null); $this->Auth->loginRedirect = array('controller' => 'Practitioners', 'action' => 'index'); $this->Auth->logoutRedirect = array(Configure::read('Routing.admin') => false, 'controller' => 'Practitioners', 'action' => 'logout'); $this->Model->authUserId = $this->Auth->user('id'); } } Thanks in advance On May 4, 10:56 am, Ryan Schmidt wrote: > On May 3, 2011, at 17:07, mthabisi mlunjwa wrote: > > > 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). > > Sounds like you've added the Auth component (possibly to your AppController). > Is that possible? If so, that's what's asking you to log in here. > > http://book.cakephp.org/view/1250/Authentication > > If you don't want users to have to log in to see your home page, then you > need to tell the Auth component that, for example by allowing the display > action. (This will allow all URLs handled by the Pages controller (not just > the home page) to be displayed.) > > http://book.cakephp.org/view/1656/allowedActions -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how can I set my home page
On May 3, 2011, at 17:07, mthabisi mlunjwa wrote: > 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). Sounds like you've added the Auth component (possibly to your AppController). Is that possible? If so, that's what's asking you to log in here. http://book.cakephp.org/view/1250/Authentication If you don't want users to have to log in to see your home page, then you need to tell the Auth component that, for example by allowing the display action. (This will allow all URLs handled by the Pages controller (not just the home page) to be displayed.) http://book.cakephp.org/view/1656/allowedActions -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how can I set my home page
do u use AuthComponent? -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/5/4 mthabisi mlunjwa > 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+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php