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