i find using cakeerror can do this.

On Jun 26, 3:43 pm, rain <[EMAIL PROTECTED]> wrote:
> let's see a scene:
>
> i have a Posts controller, and the controller has a view action.
>
> <?php
> class PostsController extends AppController {
>
>         var $name = 'Posts';
>         var $helpers = array('Html', 'Form');
>
>         function view($id = null) {
>                 if (!$id) {
>                         $this->Session->setFlash(__('Invalid Post.', true));
>                         $this->redirect(array('action'=>'index'));
>                 }
>
>                 $this->set('post', $post = $this->Post->read(null, $id););
>         }}
>
> ?>
>
> the user can use the url /posts/view/1 visit a post.
>
> but when the view parameter is wrong , like /posts/view/wrong, or /
> posts/view/999999999 , then the
>  $post = $this->Post->read(null, $id); will get a null value.
>
> in this situation , i want show user a 404 error message ,  tell the
> user the requested url is not exist!
>
> how to do this! thanks!
>
> i'm using the cakephp 1.2 rc1.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to