dongxiangqian1855 2014-10-14 15:35
浏览 14

cakephp禁用分页

I need to disable pagination on cakephp 2

I get a list of elements by using PDO queries without cake find methods.

and set the result as $this->set('elements', $elements);

if I dont use $this->paginate(); I just can view the "view" as plain text, without the layout; something like:

id name Actions 1 jhon Delete 2 Pep Delete

but without any css. And viewing page source

<div class="index">
    <table cellpadding="0" cellspacing="0">
    <tr>
    <th>id</th> [...]

Means that begins on the view template, but without layout. I put a beforeFilter function calling the 'default' layout i use:

function beforeFilter(){
   parent::beforeFilter();
   $this->layout = 'default';
}

but nothing happens. If I put $this->paginate(), the the layout is rendered, but I don't make unnecessary queries. Any idea? Thanks

  • 写回答

2条回答 默认 最新

  • dongxiegao3071 2014-10-15 07:54
    关注

    If you don't want pagination then simply update your view by removing the pagination code and simply use find('all');

    You can follow the CakePHP official site document to make the concept clear.

    CakePHP Blog Tutorial

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号