Sunday, February 28, 2010

Order 2 arrays in one view

I didn't know how to explain it in the subject but this is what I
need to do with Cakephp, hope someone helps me.

I have to tables/models lets say

PARENTS
id,name
1,joe
2,mary
3,mike


SONS
id,idparent,name
1,2,john
2,2,lisa
3,2,jack
4,3,martha
5,3,brad

I want in a view to do this simple thing in a table, display the
parent in a row, and then the following rows print the sons, then the
next parent, and sons below and so on, maybe there is shorter way to
do this than the ones that I've been thinking.

example of final result in page:

parent-mary
son-john
son-lisa
son-jack
parent-mike
son-martha
son-brad


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: