Here we will use CLinkPager for example.
when using CLinkPager widget, we always follow this way:
<?$this->widget(‘CLinkPager’, array(
'pages' => $pages,
'pageSize' => 15,
))?>
'pages' => $pages,
'pageSize' => 15,
))?>
Here we set it to display 15 items per page. But if we have many action view page with CLinkPager,
we just copy and parse the code as below? can we set the default value of 'pageSize'?
Yes, it is! Thanks to Yii, we can do that in this way, we need to edit application configuration file
main.php:
return array(
...
'components'=>array(
'widgetFactory'=>array(
'widgets'=>array(
'CLinkPager'=>array(
'pageSize'=>15,
),
...
),
),
...
),
);
...
'components'=>array(
'widgetFactory'=>array(
'widgets'=>array(
'CLinkPager'=>array(
'pageSize'=>15,
),
...
),
),
...
),
);
Have fun with Yii!