English 中文(简体)
为什么有钱花在花板上工作?
原标题:why condition $id dont work with pagination?

i have two models binded with section model this two models called (gallery,article),i want to paginate all this in 概览.ctp.so i have two problems
1-when put $id in $paginate to retrieve articles by section $id i get parse error 2-how to separate between the two paginations (gallery,article) in view file ..

var $paginate = array(
      Article =>array(
      limit  => 1,
      page  => 1,
           parse error here//  
      conditions  => array( section_id =>$id)
     ),
      Gallery =>array(
      limit  => 3,
      page  => 1,
      conditions  => array( section_id =>86))


     )
     ;
    function view($id = null) {
        if (!$id) {
            $this->Session->setFlash(__( Invalid gallery , true));
            $this->redirect(array( action  =>  index ));
        }
   $gallery = $this->paginate( Gallery );
        // find Articles at sections
         $articles = $this->paginate( Article );
   $section = $this->Section->findById($id);

        // set the section for the view
    $this->set(compact( articles , gallery , section ));
    }

概览

    <div class="related">
        <table>

            <tbody>
<h3> section is <?php echo $section [ Section ][ name ]; ?></h3>
<br />
                <?php foreach($articles as $article): ?>
                <tr>
                    <td><?php if($article[ Article ][ status ]== 1){echo $article[ Article ][ title ];}  ?></td>
                    <td><?php  if($article[ Article ][ status ]== 1){echo  &nbsp; .$html->link( View ,  /articles/view/ .$article[ Article ][ id ]);}?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>



        <?php if($section[ Section ][ id ]==86): ?>
        <div class="related">

        <table>

            <tbody>

                <?php foreach($gallery as $galler): ?>
                <tr>
                 <td> <?php echo  &nbsp; .$html->link($galler[ Gallery ][ name ],  /galleries/view/ .$galler[ Gallery ][ id ]);?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>

    <p>
    <?php
    echo $this->Paginator->counter(array(
     format  => __( Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end% , true)
    ));
    ?>  </p>

    <div class="paging">
        <?php echo $this->Paginator->prev( <<   . __( previous , true), array(), null, array( class => disabled ));?>
     |  <?php echo $this->Paginator->numbers();?>
 |
        <?php echo $this->Paginator->next(__( next , true) .   >> , array(), null, array( class  =>  disabled ));?>
    </div>
     <?php endif ; ?>
最佳回答

你们可以在购买力平价的类别财产申报中使用变数或逻辑。 一种情况是,该<代码> id不适用。 在那里,变化不定。

为给主人查询创造条件,您需要在以下网址上添加这一句:

$articles = $this->paginate( Article , array( Article.section_id  => $id));

你们将努力在同一个网页上获得两件假肢,因为卡纳克民阵在接收URL的“第2页”时不会知道你正在想象的那套数据,我认为,这套数据只会使两套数据gin下。 此处为一条可能的 ha/<。

问题回答

暂无回答




相关问题
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 ...

热门标签