php - Modify request before bundle -


i have symfony website many pages

/page1 /page2 /page3/something/ etc... 

in pages, have many time word "pretty"

i page /dummy/page1 returns same /page1 replace occurence of word "pretty" word "beautiful". same thing other pages : /dummy/url should same /url replacing "pretty" "beautiful"

i have found easy way : in app.php , added @ beginning :

if (strpos($_server['request_uri'], '/dummy') !== false) {       $_server['request_uri'] = str_replace('/dummy','',$_server['request_uri']);       ob_start(replacehtml($final_html)) } 

and simply

public function replacehtml($html) {      return str_replace('pretty','beautiful',$html); } 

and work perfectly.

now need make bundle able share it.

the problem bundles seems instanciated late, meaning after request has been processed changing $_server['request_uri'] doesn't @ point, , /dummy/url request returns 404.

do have idea how reproduce using bundle ?

try create 2 routes page:

/**  * @route("/dummy/page1", name="route_dummy_1")  * @route("/page1", name="route_1")  */ public function indexaction(request $request) {  ... } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -