take my example , if I have an array like this
""""""""""
Array
(
[0] => Array
(
[name_item1] => Array
(
[date] => 2009-10-09
)
[name_item2] => Array
(
[id] => 49
[name_item3] => Array
(
[0] => Array
(
[id] => 15
)
)
)
)
[1] => Array
(
[name_item4] => Array
(
[date] => 2009-10-08
)
)
)
""""""""""
I want to sort by date, the date variable is contained into name_item1
and name_item4 that are two different names
so i tried to use this path {n}.{s}.date but doesn't work probably
becouse there is name_item2 and name_item3 ???
On 7 Ott, 18:38, brian <[email protected]> wrote:
> On Wed, Oct 7, 2009 at 10:17 AM, alberto <[email protected]> wrote:
>
> > Where I can find the syntax of the variable $path that are passed to
> > the Set:sort ?
>
> For sort() you'll probably be using '{n}.ModelName.field_name'. The
> '{n}' part represents the array index and you provide that exactly as
> shown. You just need to change the 'ModelName' and 'field_name' bits.
>
> The 2nd link here shows how to use '{s}', which is even more fun.
>
> http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakf...http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakep...http://book.cakephp.org/view/640/Set
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---