Posted By

inamorix on 10/10/07


Tagged

php


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gedittest


CakePHP ErrorHandler+Smarty


 / Published in: PHP
 

  1. <?php
  2. class AppError extends ErrorHandler {
  3. private $_method;
  4. private $_messages;
  5.  
  6. public function __construct ($method, $messages) {
  7. $this->_method = $method;
  8. $this->_messages = $messages;
  9. parent::__construct('error', $messages);
  10. }
  11.  
  12. public function error ($params) {
  13. $this->controller =& new SmartyController();
  14.  
  15. if ($this->_method == 'error') {
  16. parent::error($params);
  17. }
  18. else if (Configure::read() > 0) {
  19. call_user_func_array(array(&$this, $this->_method), $this->_messages);
  20. }
  21. else {
  22. $this->_method = 'error';
  23. call_user_func_array(array(&$this, 'error404'), $this->_messages);
  24. }
  25. }
  26. }
  27. ?>

Report this snippet  

You need to login to post a comment.