Is there a way to return REFERRER to Yii module / controller / form?

I use:

if(!empty(YII::app()->request->urlReferrer))echo YII::app()->request->urlReferrer;

      

But I would like to use the value YII::app()->request->urlReferrer

with CHtml::link(...)

and create a link tag;

I don't want to write:

<a href="<?php echo YII::app()->request->urlReferrer; ?>">Go Back</a>

      

I would like to extract a module, controller, action from REFERRAL.

I started thinking and writing a blueprint and I found out that I need to keep the original module / controller / action on some of my web pages; If the user has to navigate somewhere, some of these pages will use the stored data, such as the module / controller / action and the current page, if available, and the number of items on the page, if available;

So, I also need a way to save the original state of the entire web page, and if the user wants to return to the original page, I need to load the saved data;

+3


source to share


1 answer


You can try this:



echo CHtml::link(
        'Go Back',
        empty(Yii::app()->request->urlReferrer)?'#':Yii::app()->request->urlReferrer
);

      

+3


source







All Articles