【问题标题】:cakephp pagination controllercakephp分页控制器
【发布时间】:2016-04-11 14:12:02
【问题描述】:

我应该在控制器中写什么来进行分页 这是我的索引

<?php foreach ($bien['Servicebien'] as $servicebien): ?>
                <tr> <td><?php echo $servicebien['dateServiceBienDu']; ?>
                    <td><?php echo $servicebien['dateServiceBien']; ?></td>
                    <td><?php echo $servicebien['montantServiceBien']; ?></td>


                </tr>
            <?php endforeach; ?>
            <?php unset($servicebien); ?>
            </table> 
            <div>
<?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}'))); ?>

Paginator->prev(' 'disabled')); echo $this->Paginator->numbers(); echo $this->Paginator->next(' Next >> ', null, null, array('class' => 'disabled')); ?>

【问题讨论】:

    标签: cakephp pagination


    【解决方案1】:

    $data = $this->Paginator->paginate('model_name');

    $this->set('data', $data);

    【讨论】:

    • 这个鳕鱼不起作用,因为我有 $bien['Servicebien']
    【解决方案2】:

    试试这个

    class FeedsController extends AppController {
    
        public $components = array( 'Search.Prg');
    
        public function beforeFilter() {
             parent::beforeFilter();
        }
    
        function indes(){
            $this->Prg->commonProcess();
    
            $this->{$this->modelClass}->data[$this->modelClass]         =     $this->passedArgs;
            $parsedConditions = $this->{$this->modelClass}->parseCriteria($this->passedArgs);
    
            $this->paginate = array(
                'conditions' => array(),
                'limit'      => 10,
                'fields'    =>   array(),
                'order'         =>  'id DESC'    
            );        
            $result    =    $this->paginate();
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-01-20
      • 2011-12-02
      • 1970-01-01
      • 2011-05-08
      • 1970-01-01
      • 2011-07-29
      • 1970-01-01
      • 2013-06-02
      • 1970-01-01
      相关资源
      最近更新 更多