English 中文(简体)
显示特定条件的 cakephp 显示数据
原标题:cakephp displaying data on specific conditions
  • 时间:2012-05-26 14:02:32
  •  标签:
  • cakephp

我创建了一个关系请求页面, 现在的问题是, 当我进行关系活动时, 它会继续显示在视图中。 我只要显示字段活动 =false 的要求 。

这是我的请求控制器,它因为阵列而坠毁, 我怎样才能绕过这个?

public function request(){
        $this->set( title_for_layout ,  Relationships );
        $this->set( stylesheet_used ,  homestyle );
        $this->set( image_used ,  eBOXLogoHome.jpg );   
        $this->layout= home_layout ;
        $userid = $this->Auth->user( username );
        $this->set( Relationships , $this->Relationship->find( all , array( conditions  => array( Relationship.partytwo  => $userid)) array( conditions =>array( Relationship.active =false))));

    }

笑笑,这是我的观点

<?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($relationship[ Relationship ][ partyone ], array( action => approve , $relationship[ Relationship ][ id ])); ;?>
                        </td>

                    </tr>
                <?php endforeach; ?>

            </table>
问题回答

尝试此选项用于设定语句 :

$this->set( Relationships , $this->Relationship->find( all , 
  array( conditions  => array(
     Relationship.partytwo  => $userid,
     Relationship.active  => false)
  )
));




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

Using DISTINCT in a CakePHP find function

I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

Prevent controller from trying to autoload model

I am a beginning Cake user and trying to do some work on an already existing application. Running into a problem when I create a new controller. I have created StoreController and when I try to call ...

热门标签