I was looking for a way to raise 404 inside controller actions but didnt
found anything about it.
Below is the solution i'm using right now but I have the feeling there
must be a better way.
I would like to know what people think, whats the proper way?
class AppController extends Controller
{
function notFound()
{
$this->cakeError('error404', array(array('className' =>
$this->modelClass, 'webroot' => '', 'base' => $this->base, 'action' =>
$this->action)));
}
}
class UserController extends AppController
{
function display($name)
{
$data = $this->User->findByName($name) or $this->notFound();
$this->set('data', $data);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---