How return current URL with anchors?
Example: I'm in page www.sitename#anchor
I want get full URL www.sitename#anchor, not www.sitename.
Yii::app()->request->getUrl() isn't suitable for this purpose
Page 1 of 1
How Get Full Url With Ancors?
#2
Posted 22 October 2012 - 09:19 AM
The anchor part isn't sent to the server by the browser, so PHP can never see it.
More info here:
http://stackoverflow...tion-of-the-url
If you need it, you could use javascript to send it in a separate request.
More info here:
http://stackoverflow...tion-of-the-url
If you need it, you could use javascript to send it in a separate request.
#3
Posted 22 October 2012 - 09:21 AM
You can't get the anchor as it is not submitted to the server. If you need it you have to do an ajax request.
#5
Posted 22 October 2012 - 09:40 AM
Maybe i don't see simple solution.
I used extension rrgridview.
I use filters and choose one of record and go to it update.
I need to return back after i save all changes.
How can i do it, if i can't get (easily) anchors of url?
I used extension rrgridview.
I use filters and choose one of record and go to it update.
I need to return back after i save all changes.
How can i do it, if i can't get (easily) anchors of url?
#6
Posted 22 October 2012 - 09:44 AM
to pass something in via the url you will need to use a GET or POST method. GET would be simplier if it isn't sensitive information, e.g. ?id=12&sitename=something
See my development site @ www.CodeTheInter.net (BETA)


Quote
If you make it idiot proof, they'll build a better idiot
#7
Posted 14 November 2012 - 03:24 PM
The first step is to get the grid view to generate the correct links. You'll want to add a new variable to each link (I use a variable named redir). So add the appropriate line of this to your grid view definition:
Next, you'll want to modify your controller action:
This is completely untested code, YMMV.
...
'buttons'=>array(
'update' => array(
'url'=>'Yii::app()->createUrl(Yii::app()->controller->id."/update", array("id"=>$data->id, "redir"=>Yii::app()->controller->id."/admin"))',
),
...
Next, you'll want to modify your controller action:
...
if($model->save()) {
if(isset($_GET['redir']) $this->redirect($_GET['redir']);
else $this->redirect('whatever_you_want_to_make_the_default_action');
}
This is completely untested code, YMMV.
Share this topic:
Page 1 of 1

Help















