PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, December 31, 2021

[FIXED] pagination no work it seems as if the query has not been made

 December 31, 2021     cakephp-3.0, helper, pagination     No comments   

Issue

AppView

public function initialize() {
      $this->loadHelper('Paginator', ['templates' => 'paginator-templates']);
    }

paginator-templates

return [
  'nextActive' => '<a id="enlace" class="next" rel="next" href="{{url}}">{{text}}</a>',
  'nextDisabled' => '<li class="next disabled"><a href="" onclick="return false;">{{text}}</a></li>',
  'prevActive' => '<a id="enlace" class="prev" rel="prev" href="{{url}}">{{text}}</a>',
  'prevDisabled' => '<li class="prev disabled"><a href="" onclick="return false;">{{text}}</a></li>',
  'counterRange' => '{{start}} - {{end}} of {{count}}',
  'counterPages' => '{{page}} of {{pages}}',
  'first' => '<a id="enlace" class="first" href="{{url}}">{{text}}</a>',
  'last' => '<a id="enlace" class="last" href="{{url}}">{{text}}</a>',
  'number' => '<a id="enlace" class="number" href="{{url}}">{{text}}</a>',
  'current' => '<li class="active"><a href="">{{text}}</a></li>',
  'ellipsis' => '<li class="ellipsis">&hellip;</li>',
  'sort' => '<a id="enlace" class="sort" href="{{url}}">{{text}}</a>',
  'sortAsc' => '<a id="enlace" class="asc" href="{{url}}">{{text}}</a>',
  'sortDesc' => '<a id="enlace" class="desc" href="{{url}}">{{text}}</a>',
  'sortAscLocked' => '<a id="enlace" class="asc locked" href="{{url}}">{{text}}</a>',
  'sortDescLocked' => '<a id="enlace" class="desc locked" href="{{url}}">{{text}}</a>',
];

PersonasController

 public $paginate =  [


                        'limit' => 25,
                          'order' => ['Personas.id' => 'asc'],]
                        ];

    public function initialize() {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('Paginator');
    }

public function index() {
      $personas = $this->paginate($this->Personas);
      $this->set('personas', $personas);
}

index

<table class="tabla caption">
    <tr class="fila1">
      <th class="col col-fila1">
        ID
        <?= $this->Paginator->sort('id', '▲', ['direction' => 'asc', 'lock' => true, 'escape' => false]) ?>
        <?= $this->Paginator->sort('id', '▼', ['direction' => 'desc', 'lock' => true, 'escape' => false]) ?>
      </th>
      <th class="col col-fila1">
        Orden
        <?= $this->Paginator->sort('orden', '▲', ['direction' => 'asc', 'lock' => false]) ?>
        <?= $this->Paginator->sort('orden', '▼', ['direction' => 'desc', 'lock' => false]) ?>
      </th>
      ....


  <?= $this->Paginator->next(__('Siguiente ') . ' ►') ?>
      </th>
      <th class="col col-der">
        <?= $this->Paginator->last(__('Ultima ') . ' >>') ?>
      </th>
    </tr>
  </table>

  <div class="paginas">
    <p><?= $this->Paginator->counter(['format' => __('Pagina {{page}} de {{pages}}, mostrando {{current}} registro(s) de un total de {{count}}')]) ?></p>
</div>

routes

 Router::scope('/Personas', function($routes) {   
   $routes->connect('/index/*', ['controller' => 'Personas', 'action' => 'index']);

Whether I try to order, how to go to the next page does nothing.

I have looked here and on other pages, people with similar problems, videos on YouTube, several examples, etc. in theory I have everything right, but it does not work, in the browser in both Chrome and Mozilla I have inspected the code for errors, But it doesn't give me any mistakes. It simply does nothing.

The path of the pages: Personas/index?page=2

The route to order: Personas/index?sort=id&direction=asc

It always shows the first 25 results ordered by the asc ID, which is the default query.


Solution

The problem was in the configuration of Nginx, in:

location / {

I just had to change this line:

try_files $uri $uri/ /index.php;

for this one:

try_files $uri /index.php?$args;

and it all worked.



Answered By - Isaac Palacio
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing