Router::connect('/musicians/:id', array('controller' => 'requests',
'action' => 'view'));

2008/6/1 cronet <[EMAIL PROTECTED]>:

>
> Thanks for Response!
>
> But thats not exactly what I need.
> In your case the var iss always passed as first argument.
> e.G. for URL: /musician/3
> > // $this->passedArgs[0] == 'musician'
> > // $this->passedArgs[1] == '3'
>
> In controller it would be:
> function view( $type, $id) {
> }
>
> But I would like to do something like that:
>
> function view($id) {
> switch( $this->params['named']['type'] ) {
> }
> }
>
> Perhaps it makes no difference. Perhaps is your solution the smarter
> one...
>
>
> Background is the following:
> I have about 6 Tables which have (nearly) the same fileds. 7 of 10
> fields are the same. So i would like to pass the type as named param
> to get the different treatements of the fields...
>
> Regards,
> Alexander
>
>
> On 1 Jun., 04:26, "b logica" <[EMAIL PROTECTED]> wrote:
> > Router::connect('/musicians', array('controller' => 'requests',
> > 'action' => 'view', 'musician'));
> > // $this->passedArgs[0] == 'musician'
> >
> > Router::connect('/bands', array('controller' => 'requests', 'action'
> > => 'view', 'band'));
> > // $this->passedArgs[0] == 'band'
> >
> > On Sat, May 31, 2008 at 6:00 PM, cronet <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > I want to achieve different URLs map to the same controller with
> > > different named arguments. The named arguments should not appear in
> > > the URL itselfs...
> >
> > > Examples:
> >
> > > URL: /musicians
> >
> > > Mapped to:
> > > RequestsController->view();
> > > $this->passedArgs['type'] = 'musician';
> >
> > > URL: /bands
> >
> > > Mapped to:
> > > RequestsController->view();
> > > $this->passedArgs['type'] = 'band';
> >
> > > Is this possible?
> >
> > > Regards,
> > > Alexander
> >
>


-- 
FireYang
www.fireyang.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to