Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* フィルター [#kdb612af]
** フィルタークラス [#k75e6e0f]
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>', $ht...
$response->setContent($html);
}
}
** フィルター設定 [#mdcaea3b]
frontend/config/filters.yml:
rendering: ~
security: ~
foofilter:
class: fooFilter
cache: ~
common: ~
execution: ~
** 参考 [#v5f82da1]
http://www.symfony-project.org/book/1_2/06-Inside-the-Con...
終了行:
* フィルター [#kdb612af]
** フィルタークラス [#k75e6e0f]
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>', $ht...
$response->setContent($html);
}
}
** フィルター設定 [#mdcaea3b]
frontend/config/filters.yml:
rendering: ~
security: ~
foofilter:
class: fooFilter
cache: ~
common: ~
execution: ~
** 参考 [#v5f82da1]
http://www.symfony-project.org/book/1_2/06-Inside-the-Con...
ページ名: