大家只是想知道你是否在foreach循环中打印出来的东西,你会如何对它进行编码,以便只有一组与该人有关的特定数据。例如,我希望它在我的关系表中的活动时打印= false或0
这是我在视图中的当前代码。
<?php foreach($Relationships as $relationship):?>
<tr>
<td align='center'><?php echo $relationship['Relationship']['partyone']; ?></td>
<td align='center'><?php echo $relationship['Relationship']['partytwo']; ?></td>
<td> </td>
<td><?php echo $this->Html->link('approve', array('action'=>'approve', $relationship['Relationship']['id'])); ;?>
<td><?php echo $this->Html->link('Decline', array('action'=>'decline', $relationship['Relationship']['id'])); ;?>
</td>
</tr>
<?php endforeach; ?>
答案 0 :(得分:0)
错误是我在控制器中的查找条件,而不是视图。这是我必须为我的控制器编写的代码行
$this->set('Relationships', $this->Relationship->find('all', array('conditions' => array('Relationship.partytwo' => $userid,'Relationship.active'=>false))));