Friday, November 30, 2012

Re: YARQ - Yet Another Routing Question

Router::connect(
'/link/:one/:two/:three/:four/:five',
array(
'controller' => '...',
'action' => '...'
),
array(
'one' => '[0-9]?',
'two' => '[0-9]?',
'three' => '[0-9]?',
'four' => '[0-9]?',
'five' => '[0-9]?',
'pass' => array('one', 'two', 'three', 'four', 'five')
)
);


public function foo($one = null, $two = null, $three = null, $four =
null, $five = null)
{
die(debug(array($one, $two, $three, $four, $five)));
}


On Fri, Nov 30, 2012 at 9:17 AM, Advantage+ <movepixels@gmail.com> wrote:
>
>
> When defining a route in routes.php what is the correct way to code a link
> to a function where different variables can be passed?
>
>
>
> For example the link can pass up to 5 args www.example.com/link/2/5/0/2/6 or
> as little as 1 www.example.com/link/2
>
> Looking at the book it shows basic pass => for the know vars being passed
> but what if the vars passed can vary from 1 var to 5 vars.
>
>
>
> I'm sure you do not to make 5 routes depending on each scenario?
>
>
>
> Any insight would be great.
>
>
>
> Thanks all
>
>
>
> Dave
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
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 cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: