views:

1368

answers:

1

How do you style the paginator with CSS used in CakePHP?

I can't find a way to attach a CSS class / ID to each of the "span" generated by the default pagination helper in CakePHP.

+2  A: 

see: http://www.switchonthecode.com/tutorials/cakephp-part-6-pagination and http://api.cakephp.org/class/paginator-helper

What stands out here is that you can pass options to next(), prev(), and numbers()

what you want to do is pass the class option.

e.g.

  $paginator->prev(
    '<< Previous',
    array(
      'class' => 'PrevPg'
    ),
    null,
    array(
      'class' => 'PrevPg DisabledPgLk'
    )
  ).
  $paginator->numbers(
    array(
      'class' => 'numbers'
    )
  ).
  $paginator->next(
    'Next >>',
    array(
      'class' => 'NextPg'
    ),
    null,
    array(
      'class' => 'NextPg DisabledPgLk'
    )
  ),
  array(
    'style' => 'width: 100%;'
  )
Jonathan Fingland
Thanks, actually I've came across the paginator helper page on cakephp.org, it may sounds stupid but where can I find a list of options available that I can pass as the arguments?
SteD
near the top of http://api.cakephp.org/file/libs/view/helpers/paginator.php you can see a list of accepted options. Strangely it doesn't include "class" or "style" though.... I am forced to assume that options not on that list are simply passed on as attributes to the element generated.
Jonathan Fingland