Posted By

daisuke103 on 01/15/09


Tagged

php view textmate error app cake


Versions (?)

PHP Cake1.2 エラー処理のハンドリング


 / Published in: Other
 

  1. /app/error.php
  2. -------------------
  3. <?php
  4. class AppError extends ErrorHandler {
  5. // 大元の"error"アクションをオーバーライド
  6. function error($params) {
  7. extract($params, EXTR_OVERWRITE);
  8. // 引き継ぐ配列の内容をセット
  9. $this->controller->set(array(
  10. 'code' => $code,
  11. 'name' => $name,
  12. 'url' => $url,
  13. 'message' => $message,
  14. 'title' => $code . ' ' . $name
  15. ));
  16. // _outputMessage = view のctpのファイル名
  17. $this->__outputMessage('message');
  18. }
  19. }
  20. ?>
  21.  
  22.  
  23. /app/views/errors/message.ctp
  24. -------------------
  25. <h2><?php echo $name; ?></h2>
  26. <p class="error">
  27. カスタムエラーページ<br>
  28. <strong><?php __('Error'); ?>: </strong>
  29. <?php echo sprintf(__("The requested address %s was not found on this server.", true), "<strong>'{$message}'</strong>")?><br>
  30. URL:<?php echo $url ?>
  31. </p>

Report this snippet  

You need to login to post a comment.