CLinkPager and first page and last page display

Site has moved

This site has moved to a new location. Visit the new site at

By Ronald van Belzen | February 7, 2015

When showing content with CGridView or CListView a pager is included. This pager shows the navigation for 10 pages and a next page and a previous page link.

What is not shown by default are the first and last page links. The simplest way of displaying these links, when you need them, is by overriding the class associated to these links. Below an example is shown for a CListView.

$this->widget('zii.widgets.CListView', array( 
  'pager'=>array('firstPageCssClass'=>'previous', 'lastPageCssClass'=>'next'), 
)); ?>

The firstPageCssClass and lastPageCssClass are the values that are overridden.

This is very much a short cut. The proper way to do it is to overwrite the CSS yiiPager.first and yiiPager.last and not to override the pager in a CListView or CGridView at all.