Re: Controller default method

2009-04-06 Thread Toby

Thanks Brian.  And thanks about the error code.

Am fairly new to CakePHP.  Have played with it for a little while, but
am working on my first commercial project with it now.

T

On Apr 6, 4:07 pm, brian  wrote:
> On Mon, Apr 6, 2009 at 10:53 AM, Toby  wrote:
>
> > Thanks for this.  And thanks Brian for the comment.  Is it not better
> > to redirect the user though, so that they see that the action doesn't
> > exist (and any search engines can too)?
>
> Yes, absolutely. I misunderstood what you wanted to do. In this case,
> use redirect for sure. Note that you can pass an error code as well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-06 Thread brian

On Mon, Apr 6, 2009 at 10:53 AM, Toby  wrote:
>
> Thanks for this.  And thanks Brian for the comment.  Is it not better
> to redirect the user though, so that they see that the action doesn't
> exist (and any search engines can too)?

Yes, absolutely. I misunderstood what you wanted to do. In this case,
use redirect for sure. Note that you can pass an error code as well.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-06 Thread Toby

Thanks for this.  And thanks Brian for the comment.  Is it not better
to redirect the user though, so that they see that the action doesn't
exist (and any search engines can too)?

T

On Apr 6, 12:08 am, Miles J  wrote:
> Besides using the index action, there is no such feature. You could
> however do something like this:
>
> function beforeFilter() {
>         if (!in_array($this->params['action'], get_class_methods($this))) {
>                 $this->redirect(); // to some action
>         }
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-05 Thread Miles J

I wasn't aware of that function, but you should probably listen to
brian. :]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-05 Thread brian

Better to use $this->setAction('action_name') rather than redirect()
as the latter forces a new request.

On Sun, Apr 5, 2009 at 7:08 PM, Miles J  wrote:
>
> Besides using the index action, there is no such feature. You could
> however do something like this:
>
> function beforeFilter() {
>        if (!in_array($this->params['action'], get_class_methods($this))) {
>                $this->redirect(); // to some action
>        }
> }
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-05 Thread Miles J

Besides using the index action, there is no such feature. You could
however do something like this:

function beforeFilter() {
if (!in_array($this->params['action'], get_class_methods($this))) {
$this->redirect(); // to some action
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-05 Thread websurfshop

If you do not specifically name an action in the url it will default
to the index action.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Controller default method

2009-04-04 Thread Toby

A fairly simple question I'm sure, but I can't seem to find it
anywhere online...  Is there a name you can give an action in a
controller that will make it act as a catch-all actions for any
undefined actions for that controller?

I have found a way around this by defining the defaults in the
routes.php file, but would prefer to have this functionality kept
within the controller.

Thanks,

Toby
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---