Yii Framework Forum: createUrl to current route? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

createUrl to current route? Rate Topic: -----

#1 User is offline   Thomas Jensen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 01-August 09

Posted 12 June 2011 - 08:04 AM

Hi,

How do i make a link to the current page?
I've tried
$this->createUrl($this->route);
, but it doesn't take params with it and
$this->createUrl($this->route,$_GET);
seems kind of ugly?

Thanks.
0

#2 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 12 June 2011 - 10:21 AM

Maybe this helps you: http://www.yiiframew...ryString-detail
┬┐How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#3 User is offline   Thomas Jensen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 01-August 09

Posted 12 June 2011 - 11:59 AM

Not really.. :(
0

#4 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 12 June 2011 - 04:08 PM

$this->createUrl('')

0

#5 User is offline   Thomas Jensen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 01-August 09

Posted 15 June 2011 - 05:55 AM

Will it obey the url rules and add params?
0

#6 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 15 June 2011 - 07:56 AM

I use without shame $this->createUrl($this->route,$_GET);
1

#7 User is offline   Fragoulas 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 11-July 11

Posted 10 July 2012 - 03:30 AM

View Postzaccaria, on 15 June 2011 - 07:56 AM, said:

I use without shame $this->createUrl($this->route,$_GET);


I think the correct would be

$this->createUrl('/'.$this->route,$_GET);

0

#8 User is offline   drylko 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 86
  • Joined: 13-September 09
  • Location:Poland

Posted 10 July 2012 - 07:01 AM

Hi,

View PostThomas Jensen, on 12 June 2011 - 08:04 AM, said:

How do i make a link to the current page?


I know this is not the answer to your question (well, maybe partial :) ), but why won't you use url currently requested?

d
0

#9 User is online   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,152
  • Joined: 10-October 10
  • Location:Denmark

Posted 10 July 2012 - 07:02 AM

It's better to use the current route as the URL can change depending on the URL rules.
"Less noise - more signal"
0

#10 User is offline   Kostas Apazidis (KonApaz) 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,361
  • Joined: 21-February 11
  • Location:Greece

Posted 16 September 2015 - 04:49 AM

View Postzaccaria, on 15 June 2011 - 07:56 AM, said:

I use without shame $this->createUrl($this->route,$_GET);



Hi Zaccaria

I had create current url adding extra parameter(s) in 2-3 different ways in the past.
But I had a few problems with url rules or (I think) security weakness

Your way is short and straight full

Please let me know:

1) Is there any problem with url manager rules ?
2) Is there any security issue ? (hacking etc)

Thanks
Yii is the best php framework in the world!
It is also powerful and flexible for large scale websites
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users