2011-11-29 2 views
1

표준 symfony sfWebResponse를 확장했으며 응답에서 html을 수정하고 싶습니다.symfony 1.4 sfWebResponse sendContent 전에 내용 수정

이 작업을 수행하는 유일한 방법은 표준 sendContent 함수를 복제하고 에코되기 전에 $ content의 html을 수정하는 것입니다.

내가 잘못 생각하고 있습니까? (나는 느낌이있다).

답변

2
+0

감사합니다. 파스칼 덕분에 올바른 경로로 나를 보내 셨습니다. –

+0

실제로 sfResponse 클래스에있는 것과 비슷한 것을 사용했습니다. $ this-> getContent());'$ event-> this-> dispatcher-> filter (새로운 sfEvent ($ this, 'response.filter_content' –

0

는, 필터를 만듭니다 바로 출력 (filter.yml의 순서) 전에 이동을하고 얻을 수있는 sfWebResponse를 사용하여 콘텐츠를 설정하십시오.

class makestuff extends sfFilter { 

    public function execute(sfFilterChain $filterChain) { 
     $filterChain->execute(); 
     $response = $this->getContext()->getResponse(); 
     $response->setContent( $response->getContent()." this comes after </html>"); 
    } 
} 
관련 문제