Just wanted to know what the best way is to acheive what I am doing.
My requirement, to show a different home page to the user dependant on
2 things.
1) If they are logged in
2) What 'user level' they are (A custom variable in my users table,
which I use to identify different user types)
>From looking around, I've created a 'myindex' controller, which one
action 'index'. Then I set the route as follows:-
Router::connect('/', array('controller' => 'myindex', 'action' =>
'index'));
replacing the previous
Router::connect('/', array('controller' => 'pages', 'action' =>
'display', 'home'));
then the index action is something like
if($this->Auth->User('accounttype_id')==ACCOUNTTYPE_ADMIN)
$this-
>redirect(array('controller'=>'dashboard','action'=>'index','admin'=>1));
etc..
with a default for not logged in users of
$this-
>redirect(array('controller'=>'pages','action'=>'display','home'));
but then I wanted the default home page url to be just www.mydomain.com
So I created myindex/index.ctp and put the static HTML from pages/
home.ctp into this.
This all seems to work, but I just wanted to know if there are better
ways to handle this?
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php