Yii Framework Forum: Remove regular expressions from URL - Yii Framework Forum

Jump to content

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

Remove regular expressions from URL

#1 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 21 May 2012 - 03:40 PM

Now url manager work with regular expressions:

array(
    'articles'=>'article/list',
    'article/<id:\d+>/*'=>'article/read',
)


But, ... php is variant. We do not care about type of var. We just need to know var name.

array(
    'articles'=>'article/list',
    'article/<id>/*'=>'article/read',
)

0

#2 User is offline   Jaggi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 05-September 11

Posted 21 May 2012 - 04:06 PM

Regular expression has a big use in the url manager when you need to build complex urls, an example when creating SEO urls. Your url might be mysite.com/my-pretty-title-234

you may only need the 234 as that is the id (imagine this is a crud controller). Regex is a valuable tool here for parsing such things.
See my development site @ www.CodeTheInter.net (BETA)

Posted Image Posted Image

Quote

If you make it idiot proof, they'll build a better idiot
0

#3 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 21 May 2012 - 04:16 PM

I agree with Jaggi.
If sensorario's proposition is to be implemented, it could be in the form of a default regex (something like this: ".+?(?=/|$)") for rules without one.
0

#4 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 23 May 2012 - 09:11 AM

Moreover, regexps are not the fastest thing on earth.
Yii user #37
0

#5 User is offline   Jaggi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 05-September 11

Posted 25 May 2012 - 03:05 AM

View Postekerazha, on 23 May 2012 - 09:11 AM, said:

Moreover, regexps are not the fastest thing on earth.


not the slowest either
See my development site @ www.CodeTheInter.net (BETA)

Posted Image Posted Image

Quote

If you make it idiot proof, they'll build a better idiot
0

#6 User is offline   rAWTAZ 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 08-January 10

Posted 25 May 2012 - 01:53 PM

I completely agree that regex definitions in the url rules should be kept. They have a fundamental role in the rules.
0

#7 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 26 May 2012 - 03:00 AM

View PostJaggi, on 25 May 2012 - 03:05 AM, said:

not the slowest either


But Yii is a "high performance framework" not a "not so slow framework"...
Yii user #37
0

#8 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 26 May 2012 - 04:05 AM

With opinions like that, it could easily turn into a "no features framework" as well ;)
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#9 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 26 May 2012 - 04:30 AM

View PostDa:Sourcerer, on 26 May 2012 - 04:05 AM, said:

With opinions like that, it could easily turn into a "no features framework" as well ;)


With opinions like that, it's a "no slow features framework" ;)
Yii user #37
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