I have a module tag with a param that accepts a string.

{exp:test:foo return_url="{current_url}"}

In the module method, I get the return_url param using

$return_url      = $this->EE->TMPL->fetch_param('return_url');

The problem is that I get the literal string


As opposed to it being parsed and getting the current url.

Is there a way to solve this? or is this a parse order issue?


1 Answer 1


The issue is parse order. Read the attached pdf.parse order. Turn on the debugger and then view the template in your browser. Scroll down thru the debugger until you find the tag containing {current_url}. You will see that that {current_url} has not been parsed. According to the attached doc, it is not parsed until step 9 - last.

In your module, try

$uri_string = $this->EE->input->server('PATH_INFO') !== FALSE ? $this->EE->input->server('PATH_INFO') : '/'.$this->EE->uri->uri_string();


$segments = array_values($this->EE->uri->segment_array());



  • Hmm could assigning it to preload variables work? Commented Aug 30, 2013 at 0:27
  • If not, is there an alternative way to get the current url? Commented Aug 30, 2013 at 0:58
  • see updated answer
    – Lloyd Hill
    Commented Aug 30, 2013 at 1:35
  • Your solution are good. I added the solution that I used that worked for me. Commented Aug 30, 2013 at 2:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.