Friday, July 3, 2009

How can I paginate this array?

I have this array (condensed considerably so it is easier to read):

Array
(
[0] => Array
(
[Category] => Array
(
[id] => 1
)

)

[1] => Array
(
[Category] => Array
(
[id] => 2
)

)
)

What I want to do is access the "id" field, so I can use it as a
paginate condition. Obviously I can call it like this: $variable['0']
['Category']['id'] but I need to use them all.

I've tried messing about with for each loops and explode/implode. I
managed to generate a string, seperated by a comma, but the variable
didn't pass to the conditions. If I echoed the variable and copied and
pasted that output into the condition it worked so I really am
stumped.

What I am trying to do is paginate the category page so that
subcategories are included in the results as well (I am using tree
behaviour).

This is probably a lack of PHP understanding on my part, but I have
always struggled with multi dimensional arrays and would appreciate
help!
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: