0

大家好,只是想知道您是否在 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; ?>
4

1 回答 1

0

错误出现在我在控制器中的查找条件中,而不是视图中。这是我必须为控制器编写的代码行

$this->set('Relationships', $this->Relationship->find('all', array('conditions' => array('Relationship.partytwo' => $userid,'Relationship.active'=>false))));
于 2012-05-28T04:58:08.553 回答