Hello,
I wanted to have URLs like: www.mysite.com/members/membername and then act accordingly, showing the information about the member whose name is "membername". When creating, I do: e a linkToLocal: 'members/membername' Q1: Is this the preferred method of creating such URLs? When dispatching, I do something like (in "members" controller): membername := self application context route next. (memberName isNil) ifFalse: [ "show member details of member named "membername"] ifTrue: [ "show the list of all members"] Q2: Is this the preferred method of dispatching such nested URLs? Canol |
Hi Canol,
Le dimanche 5 septembre 2010 10:42:19, ZuLuuuuuu a écrit : > Hello, > > I wanted to have URLs like: > > www.mysite.com/members/membername > > and then act accordingly, showing the information about the member > whose name is "membername". > > When creating, I do: > > e a linkToLocal: 'members/membername' > > Q1: Is this the preferred method of creating such URLs? Yes, that's fine :) > > When dispatching, I do something like (in "members" controller): > > membername := self application context route next. > > (memberName isNil) > ifFalse: [ > "show member details of member named "membername"] > ifTrue: [ > "show the list of all members"] > > Q2: Is this the preferred method of dispatching such nested URLs? > Yes, using the route is the best way. If you do it in a controller method, it can be simplified with 'self route next'. However, If you use it in a widget, the way I see it widgets shouldn't be responsible for dispatching or retreiving data from the url, it should be the application's job (that's why the route is accessible from the application) in a controller method. I'm not saying it's a strict rule, but I think it's better to do it this way. Cheers, Nico -- Nicolas Petton http://www.objectfusion.fr Objectfusion S.A.R.L. Applications web - Design |
Thank you...
Canol On Sep 6, 12:45 pm, Nicolas Petton <[hidden email]> wrote: > Hi Canol, > > Le dimanche 5 septembre 2010 10:42:19, ZuLuuuuuu a écrit : > > > Hello, > > > I wanted to have URLs like: > > >www.mysite.com/members/membername > > > and then act accordingly, showing the information about the member > > whose name is "membername". > > > When creating, I do: > > > e a linkToLocal: 'members/membername' > > > Q1: Is this the preferred method of creating such URLs? > > Yes, that's fine :) > > > > > When dispatching, I do something like (in "members" controller): > > > membername := self application context route next. > > > (memberName isNil) > > ifFalse: [ > > "show member details of member named "membername"] > > ifTrue: [ > > "show the list of all members"] > > > Q2: Is this the preferred method of dispatching such nested URLs? > > Yes, using the route is the best way. > > If you do it in a controller method, it can be simplified with 'self route > next'. However, If you use it in a widget, the way I see it widgets shouldn't > be responsible for dispatching or retreiving data from the url, it should be > the application's job (that's why the route is accessible from the > application) in a controller method. > > I'm not saying it's a strict rule, but I think it's better to do it this way. > > Cheers, > Nico > -- > Nicolas Pettonhttp://www.objectfusion.fr > Objectfusion S.A.R.L. > Applications web - Design |
Free forum by Nabble | Edit this page |