Actually I needed to add it in beforeFilter in order to have the
"fields" passed as argument for paginate.
I remember trying to find out and dig in code, until I had
Router::connectNamed(array('field1', 'field2')), I kept having the
argument in passedArgs but in the form:

$this->passedArgs[0] = 'field1:value';

But again it was a while ago. I still have this option in my
application, using the SVN branch from a week ago or so, it still
work. I will try removing to check if this still works
cheers

On Nov 15, 6:56 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> No, you don't need to use connectNamed, they will be in $this-
>
> >passedArgs anyway
>
> In fact, I don't even know what connectNamed is for - something to
> look into I guess.  Even custom named routes seem to work fine without
> it - e.g
>
> Router::connect('/:language/search/:controller',
> array('action'=>'search));
> echo Router::url( array('language'=>'german') );
> => /cake1.2/german/search/posts
>
> Can anyone reading this provide a good explanation of what
> connectNamed actually does?
>
> On Nov 15, 9:19 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > In order to passedArgs to work as you described, do they still need to
> > be declared in
> > Router:::connectNamed ? I have had troubles with args, but few months
> > ago ...
> > Cheers
>
> > On Nov 15, 12:01 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > Any parameters that are optional should be done with named parameters,
> > > ie
>
> > > /your/action/id:123/parent:32
>
> > > in your action just look at $this->passedArgs['id'] and 
> > > $this->passedArgs['parent'].  These do not interfere with required
>
> > > parameters, and can be in any order.  For example, given the action
>
> > > function edit( $id=null ){
> > >   $this->log( $this->passedArgs['parent'] );
> > >   $this->log( $this->passedArgs['sibling'] );
>
> > > }
>
> > > you could access via
> > > /controller/edit/1
> > > /controller/edit/1/parent:123/sibling:432
> > > /controller/edit/sibling:432/parent:123/1
>
> > > and all would have the $id = 1
>
> > > On Nov 15, 2:51 am, kgrimm <[EMAIL PROTECTED]> wrote:
>
> > > > thanks for your help, then I will change the order of the parameters.
> > > > I had this idea too, but it means I'll have to change quite a few
> > > > pieces of existing code, and I'm always afraid of missing some.
>
> > > > On Nov 14, 5:40 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > > Pass this as the second parameter of your url, then you can default
> > > > > your second parameter to null in the controller. Of course this if you
> > > > > are not doing the same for the $part2 already ..
> > > > > Otherwise create another method in controller that calls an internal
> > > > > method (to handle both cases).
>
> > > > > On Nov 14, 5:37 pm, kgrimm <[EMAIL PROTECTED]> wrote:
>
> > > > > > actually that won't help, because I need to make a difference 
> > > > > > between
> > > > > > null and 0 (0 in this case means to create a new table row). My
> > > > > > current solution is to pass a fixed value that has no other meaning,
> > > > > > e.g. -1, and set the parameter to null in the controller function if
> > > > > > it equals it. But I don't like it that way, so I just wondered if
> > > > > > there's a possibility to pass 'null'.
>
> > > > > > On Nov 14, 5:31 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > > > > you can pass 0, in your controller you can check if($part1) for
> > > > > > > example
>
> > > > > > > On Nov 14, 5:28 pm, kgrimm <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Hi,
>
> > > > > > > > how can I pass null values to a controller function using its 
> > > > > > > > URL?
>
> > > > > > > > for example: "controller/function/par1/par2", how can I make 
> > > > > > > > par1
> > > > > > > > null?
>
> > > > > > > > Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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