Styling the pagination helper in CakePHP 3.6

Hi, I’m trying to style the pagination helper to give me a way out like this:

<div class="col col-fila1">
     ID Persona
        <a href="/users/index?sort=persona_id&amp;direction=asc" class="enlace"  id="enlace">▲</a>       
        <a href="/users/index?sort=persona_id&amp;direction=desc"  class="enlace" id="enlace">▼</a>
</div>

Actually, I have it like this:

<div class="col col-fila1">
        ID Persona
        <?= $this->Paginator->sort('personal_id','▲', null, ['direction' => 'asc']); ?>
        <?= $this->Paginator->sort('personal_id'.'▼', null, ['direction' => 'desc']); ?>      
      </div>

But it gives me back:

<div class="col col-fila1">
        ID Persona
        <a href="/users/index?sort=persona_id&amp;direction=asc">▲</a>       
        <a href="/users/index?sort=persona_id&amp;direction=desc">▼</a>
      </div>

How can I identify a class and an ID to the “a” connector?

https://book.cakephp.org/3.0/en/views/helpers/paginator.html#changing-templates-at-run-time

and here you have all possible templates

1 Like

Thanks, I modified the template of sort and it works.

Now I have another problem and is that the sort does not work, neither ascending nor descending, does nothing.

In the controller I have:

public $paginate = [
                        'fields' => [
                                     'Users.id', 'Users.persona_id', 'Users.nombre',
                                     'Users.apellido', 'Users.imagen_id' , 'Users.email',
                                     'Users.role', 'Users.active', 'Users.creado', 'Users.modificado'
                                   ],
                        'limit' => 25,
                        'order' => ['Users.id' => 'asc']
                      ];

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

public function index() {
        //$this->set('users', $this->paginate());
        $users = $this->paginate($this->Users);
        $this->set('users', $users);
}