フィルターフィルタークラスapps/frontend/lib/fooFilter.class.php: <?php class fooFilter extends sfFilter { public function execute ($filterChain) { if (!$this->isFirstCall()) { return; } $filterChain->execute(); $request = $this->getContext()->getRequest(); $response = $this->getContext()->getResponse(); $contentType = $response->getContentType(); if (strpos($contentType, 'html') === false) { return; } $html = $response->getContent(); $html = str_replce('</body>', 'TEST</body>', $html); $response->setContent($html); } } フィルター設定frontend/config/filters.yml: rendering: ~ security: ~ foofilter: class: fooFilter cache: ~ common: ~ execution: ~ 参考http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer#chapter_06_filters |
|