I have a data that I want to bring up to a view with foreach statement,... I can see notifications in debug mode, but I can't see real results...
here is my function code:
$friends = $this->Friend->find('all', array('conditions' => array('Friend.user_id' => $user['User']['id'])));
foreach($friends as $friend)
{
$conditions = array('Notification.member_id' => $friend['User']['id']);
$notifications = $this->Notification->find('all', array('conditions' => $conditions, 'order' => array('Notification.created' => 'DESC'), 'limit' => 12 ));
$this->set('notes', $notifications);
// debug($notifications);
}
and here is the view:
<?php foreach($notes as $note): ?>
<strong><?php echo $html->link($application->cut($note['User']['firstname'] . ' ' . $note['User']['lastname'], 25), '/profile/' . $note['User']['username']) ?></strong>
... ,... ,... ,...
<?php endforeach ?>
and Notification Model belongsTo association:
var $belongsTo = array(
'User' => array('className' => 'User', 'foreignKey' => 'member_id'),
thanks in advance
chris
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment