I’m new with cakephp .. sorry, if my question seems basic..
I have models: user, post, comment, all related and need to show
comments on the post view …. but also want to show the username and I can’t access this field of the user model.
I have user_id and post_id in comment.php model and user_id in post.php model, but inside the loop how can i access the username field of the user model??
I have this on … posts / view.ctp
<?php foreach ($post['Comment'] as $comment): ?>
<tr<?php echo $class;?>>
// this does not work
// echo $comment['user_id']['username'];
<td><?php echo $comment['user_id']; ?>
</td>
</tr>
<tr>
<td><?php echo $comment['created'];?></td>
<td></td>
</tr>
<tr>
<td><?php echo $comment['content'];?></td>
</tr>
<?php endforeach; ?>
</table>
then how could I fix it?? thanks…
solved the problem …. the most common way of trial and error ..
how to fix it was ..
and then …