class AppError extends ErrorHandler {
function jsonError($message)
{
$this->layout = 'ajax';
$error = array ('type' => 'jsonError', 'message' =>
$message);
$this->controller->set('error', $error);
$this->controller->helpers[] = 'Javascript';
$this->_outputMessage('json_error_message');
}
}
?>
On Sep 27, 2:09 am, Christian <csuei...@gmail.com> wrote:
> Hello All,
>
> I am building an application which will communicate through REST with
> the interface, and so all of my output messages/data will be encoded
> into json to be feeded into the interface. I have created an AppError
> class to have my app specific errors (and ultimately all errors)
> encoded into json. The problem I am having is using the Javascript
> helper (so that i can easily do echo $javascript->object($messages);)
> I tried the normal approach of having a $helpers=array('Javascript');
> property, also tried doing an App::import('Javascript'); (inside the
> error method) which gave me this error: Fatal error: Class 'AppHelper'
> not found in /Users/csueiras/Sites/loc-app/cake/libs/view/helpers/
> javascript.php on line 33
>
> Can anyone point me in the right direction?
>
> Christian
>
> This is my code:
>
> <?php
> class AppError extends ErrorHandler {
> var $helpers = array('Html', 'Form', 'Javascript');
> function jsonError($message)
> {
> $this->layout = 'ajax';
> $error = array ('type' => 'jsonError', 'message' => $message);
>
> $this->controller->set('error', $error);
> $this->_outputMessage('json_error_message');
> }}
>
> ?>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment