i tried just unzip the source code and add a line <?php echo Yii::app()->user->returnUrl;?> into demos/hangman/protected/views/layouts/main.php,
then no matter what page i visit in the application, it always shows /yii/demos/hangman/index.php
Page 1 of 1
returnUrl doesn't work in 1.0.0
#2
Posted 07 December 2008 - 06:55 AM
seems its my problem
i tried 1.0rc and it still doesn't work
but i remember it works fine before
i don't know what's wrong with my configuration
i tried 1.0rc and it still doesn't work
but i remember it works fine before
i don't know what's wrong with my configuration
#3
Posted 07 December 2008 - 07:21 AM
returnUrl is set by Yii when login is required. For the hangman demo, i won't be set unless you do it explicitly in the code.
#4
Posted 07 December 2008 - 07:32 AM
oh, i see
i should use Yii::app()->getRequest()->getUrlReferrer(), right?
i should use Yii::app()->getRequest()->getUrlReferrer(), right?
#5
Posted 07 December 2008 - 07:37 AM
I don't know your goal, but if you want to know the page referrer information, yes, it is.
#6
Posted 07 December 2008 - 10:07 AM
Perhaps this is similar to my previous problem with the nice flag icons I put in the menu. When clicking one of those (to change application language) it turned out a simple refresh call would end up in a loop. I think referrer isn't used any more (nowadays)?
My solution was to save the previous url in the session object and restore it on reentering the controller. Maybe there is a better solution?
/Tommy
My solution was to save the previous url in the session object and restore it on reentering the controller. Maybe there is a better solution?
/Tommy
#7
Posted 07 December 2008 - 10:27 AM
For your problem, returnUrl won't solve your problem because you need to set it BEFORE clicking the link.
You may consider using CHtml::linkButton to render the language menu item, like the following:
Then, in the corresponding action, you will be able to know the current URL by $_POST['url'].
You may consider using CHtml::linkButton to render the language menu item, like the following:
<?php echo CHtml::linkButton('button label', array(
'submit'=>array('controllerID/actionID'),
'params'=>array('url'=>Yii::app()->request->url),
)); ?>
Then, in the corresponding action, you will be able to know the current URL by $_POST['url'].
#8
Posted 07 December 2008 - 01:15 PM
Quote
... You may consider using CHtml::linkButton ....
Thanks, that would be a less complicated solution. Maybe obvious to others, I learn everyday.
/Tommy
Share this topic:
Page 1 of 1

Help












