eZ Community » Forums » Developer » Forward module to url
expandshrink

Forward module to url

Forward module to url

Monday 20 January 2014 11:47:16 pm - 2 replies

Hi,

what is the best way to make a forward in a template? Let me explain: I would execute an action of an extension with url content. eg if I call the url www.test.fr/mycontent, I would run the url www.test.fr/mymodule/myaction?paramget1=toto&paremget2=tata without changing url. I created a template operator that calls the method eZModule :: forward, but how to pass GET parameters  to my module ?

Tuesday 21 January 2014 10:22:21 am

I am not sure I get all the details of what you want to do:

1) is it necessary that the redirect is done via a template operator, or would php code be ok?

2) would a (wildcard) url rewrite be enough?

 

Having said that, what I do for those kind of "redirect operators" is generally:

- create a template operator which directly does send http headers (php header() call) then calls ezexecution::cleanexit

- said operator is put in pagelayout tpl, at top of page, inside an if statement (when redirecting, no need to print full page)

- the module/view passes (via persistent variable) the target for redirection to the pagelayout

Wednesday 22 January 2014 8:24:40 pm

Gaetano thank you for your answer 

1) yes my dan forward should be a template operator 

2) in my case a rewriting is impossible 

I should not be a redirect but forward. 

eg : if I call the url http://www.monsite.fr/bonjour I want to perform an action of my extension without changing url. I have found a solution by passing the query_string in view_parameters. 

eZModule :: forward ('myextension','myaction',array('url',$url));

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from