Hi John,

AppError inherits from ErrorHandler:
class AppError extends ErrorHandler{}

And the RequestHandler is a component that can be called only from the
controller IMO but not sure.
But it only happens when I add a viewvar 'errcode'. When I remove this
one it is working correctly.

That is the strangest part.

thnx
- primeminister

On Apr 7, 1:34 pm, John Andersen <[email protected]> wrote:
> Which class does your app_error inherit from?
>
> I wonder why you have $this->controller->requestHandler-> ... instead
> of $this->requestHandler-> ...
> Enjoy,
>    John
>
> On Apr 7, 11:32 am, primeminister <[email protected]> wrote:
>
>
>
> > Anybody has an idea how to solve this?
>
> > On Apr 4, 4:56 pm, Primeminister <[email protected]> wrote:
>
> > > I try to make a custom error message and output it as a xml view.
> > > I call in the controller cakeError() :
>
> > > {{{
> > > function beforeRender()
> > > {
> > >     $this->cakeError('myError', $this->viewVars);
>
> > > }
> > > }}}
>
> > > and in my app_error.php I created a myError() method
>
> > > {{{
> > > public function myError($params)
> > >     {
> > >                 if (!isset($params['name'])) {
> > >                     $params['name'] = $this->codes[$params['code']];
> > >             }
> > >             if (empty($params['request'])) {
> > >                         $params['request'] = $this->controller->here;
> > >                 }
> > >                 if (empty($params['title'])) {
> > >                     $params['title'] = $params['code'] . ' ' . 
> > > $params['name'];
> > >             }
> > >         extract($params, EXTR_OVERWRITE);
> > >         $this->controller->set(array(
> > >             'code' => isset($code) ? $code : 404,
> > >             'request' => isset($request) ? $request : null,
> > >             'name' => isset($name) ? $name : null,
> > >             'title' => isset($title) ? $title : null,
> > >             'errcode' => isset($errcode) ? $errcode : 0,
> > >             'message' => isset($message) ? $message : null,
> > >             'invalidFields' => isset($invalidFields) ?
> > > $invalidFields : null,
> > >         ));
> > >                 
> > > $this->controller->RequestHandler->renderAs($this->controller,
> > > 'xml');
> > >                 // set header
> > >             header("HTTP/1.x $params[code] $params[name]");
> > >                 $this->_outputMessage('myError');
> > >     }
>
> > > }}}
>
> > > Now I get this Notice:
> > > Notice (8): Undefined property: Controller::$RequestHandler [APP/
> > > app_error.php, line 88
> > > Where line 88 is the line where I want the view to respondAs XML:
> > > $this->controller->RequestHandler->renderAs($this->controller, 'xml');
>
> > > But when I leave out the errocode var then everything is alright and
> > > the view is generated as a valid xml message.
>
> > > Does anybody knows how this is possible?
> > > thnx!
> > > - primeminister
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to