ExceptionRendererを拡張して、CakePHP2.0でカスタム404ページを作成しようとしています。View CakeでHTMLマークアップされた文字列を出力する場合を除いて、すべてが正常に機能しています。HTMLエンティティが不要にエンコードされています。どうすればこれを防ぐことができますか?
私のレンダラーには次のものがあります:-
class AppExceptionRenderer extends ExceptionRenderer {
public function missingController($error) {
$this->controller->set('test', '<p>Test</p>');
header('HTTP/1.1 404 Not Found');
$this->controller->render('/Errors/error404', 'default');
$this->controller->set('title_for_layout', 'Page Not Found');
$this->controller->response->send();
}
}
ビュー(View / Error / error404.ctp):-
<?php echo $test ?>
<test>
これはではなく出力します<p>test</p>
。
私の実際のコードtest
では、これはCMS主導のサイトであるため、データベースのコンテンツによって設定されます。test
例として、上記のレンダラーコードを設定しているだけです(そして、コードが観察しているとおりに動作していることを証明します)。