cakephp分页控制器

时间:2016-04-10 23:04:29

标签: cakephp pagination

我在控制器中写的是什么,以便进行分页 这是我的索引

<?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-&gt; prev('&lt;&lt; Previous',null,null,array('class'=&gt;'disabled'));  echo $ this-&gt; Paginator-&gt; numbers();  echo $ this-&gt; Paginator-&gt; next('Next&gt;&gt;',null,null,array('class'=&gt;'disabled')); ?&GT;

1 个答案:

答案 0 :(得分:0)

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

$ this-&gt; set('data',$ data);