Yii 1.1: xreturnable


This behavior can create URLs that allow to return to a page by storing its GET Parameters on a stack.


The extension evolved from this forum discussion. Please add any comments or bug reports there.



  • Extract the release file under protected/extensions
  • Attach the beahvior in the CController::init() method of any controller you want to use it.


Create an URL that contains all the GET parameter of the current page:

echo CHtml::link('A link',

If you perform an action on the page user/edit you can use this code to return to the originating page:


or create a link to the originating page in the view with:

echo CHtml::link('Cancel',$this->getReturnUrl())

See the included demo for a more extensive example.

This project is hosted on github.

Change Log

Release 1.0.3, January 24, 2013

  • Fixed bug with URL creation from module (gerthelsen)

Release 1.0.2, November 11, 2009

  • Fixed bug with multi-dim GET parameters (thanks to Márcio for supplying a fix)
  • Name of GET stack variable is now configurable with paramName

Release 1.0.1, July 13, 2009

  • Fixed bug with url compression and path format (thanks to robak for finding this)

Release 1.0.0, June 8, 2009

  • Initial release

Total 7 comments

#12575 report it
Mike at 2013/03/29 10:01am
Re: Repo?

@schmunk Done :)

#12558 report it
schmunk at 2013/03/28 02:38pm

Could you put it on github?

#11647 report it
gerthelsen at 2013/01/24 02:24pm
support for modules

Yep, works fine now!

#11634 report it
Mike at 2013/01/24 02:56am
Re: support for modules

Thanks, i've updated the extension. Could you test it please?

#11629 report it
gerthelsen at 2013/01/23 02:30pm
support for modules

The extension does not support urls going to modules. For instance when going from "controllerA/actionA" to "module/controllerB/actionB" and returning, it returns to "module/controllerA/actionA". The solution is simple: just replace "$this->getOwner()->createUrl" everywhere in the extension component by "Yii::app()->createUrl".

#1531 report it
robak at 2009/07/05 11:10am
404 PageNot found Error

When using path url format I've got 404 error from web server.

My sollution: add urldecode and urlencode to urlCompress and Uncompress

public static function urlCompress($data) {
  return urlencode(base64_encode(addslashes(gzcompress(serialize($data),9))));

public static function urlUncompress($data) {
  return unserialize(gzuncompress(stripslashes(base64_decode(urldecode($data)))));
#1556 report it
velsa at 2009/06/24 12:07pm
how to install

how to install xReturnable

Leave a comment

Please to leave your comment.

Create extension