05-16-2008, 11:29 AM
[eluser]skattabrain[/eluser]
ok, still new to CI ... and object orientated design. i have no problems doing this procedurally.
creating a profile page for users ... on this page i load their details, then any comments made about them. i also want to include a list of replies for each on those comments.
i pass the data to my view like this ...
so i fetch my client, then all comments made on them, here's the code to fetch the comments ...
now, i get the replies to each of these comments ...
the trouble i'm having is attaching this new reply array to the exisiting comment array ... so in my view i can simply loop through each comment, and while in a comment, i check for replies and loop through them before moving to my next comment. not really sure how to do this ... again, i've done this procedurally forever now ...
ok, still new to CI ... and object orientated design. i have no problems doing this procedurally.
creating a profile page for users ... on this page i load their details, then any comments made about them. i also want to include a list of replies for each on those comments.
i pass the data to my view like this ...
Code:
$this->load->view('profile.php', $data);
so i fetch my client, then all comments made on them, here's the code to fetch the comments ...
Code:
$comments = $this->Profile_data->getCoComments($clientID);
$data['comments'] = $comments;
now, i get the replies to each of these comments ...
Code:
if ($comments->num_rows() > 0)
{
foreach ($comments->result() as $comment)
$replies = $this->Profile_data->getReplies($comment->commentID);
}
the trouble i'm having is attaching this new reply array to the exisiting comment array ... so in my view i can simply loop through each comment, and while in a comment, i check for replies and loop through them before moving to my next comment. not really sure how to do this ... again, i've done this procedurally forever now ...