Hey guys, take for expample these 3 models: news ,replies and user (news hasmany replies, replies belongsto news, user hasmany replies, replies belongsto user)
if i do a $this->Reply->findAll(); and pr() the result, i get something like this: http://cakephp.org/pastes/show/5f0832117abd07387e6284bebb52ef01 on the other hand, if i do a $this->News->findAll(); and pr() the result, i get something like this: http://cakephp.org/pastes/show/0ba2f5fad72cfa8ae514b7e8212bc463 the arrays are very similar, they contain the same data (atleast as far as i'm interested in ), but the arrays are organised totally different. i'll show you why this is a "problem" for me. i have an element that displays 1 single reply, it also needs the username of the person who posted the reply offcourse. so this element contains some stuff like this: <?php echo $date->date($reply['Reply']['modified'],'l j-n-Y '); echo $reply['Reply']['username']; echo $reply['Reply']['body']; ?> this works perfectly when rendering reply's that i take from the first array, but i also want to show replies for newsitems, so rendering the same element as before ( i don't want more then 1 piece of code to do the same thing), but my data array is organised different (paste 2), so i wonder how i should do this. i could offcourse add some juggling with the contents of the array to the element file: write some php code that detects the structure of the array, cuts chuncks out of it, and makes a new "universal" one, but i think that's over the top, and probably not nessecary. (i bet there is a "smart" solution for this) so how do you guys deal with this problem? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
