A
A
Artur Kosikov2017-09-20 15:13:08
Yii
Artur Kosikov, 2017-09-20 15:13:08

Why does the LinkPager widget display links with GET parameters (not CNC)?

In the router:

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules'=>array(
                ''=>'main/index',
                '<region>' => 'main/index',
                '<region>/<category>' => 'main/index',
                '<region>/<category>/<page:\d+>' => 'main/index',
            ),
        ],

In the controller I use:
$pages = new \yii\data\Pagination(['totalCount' => $query->count(), 'pageSize' => PER_PAGE, 'pageSizeParam' => false, 'forcePageParam' => false]);

In the view - I display pagination:
<?= \yii\widgets\LinkPager::widget(['pagination' => $pages]) ?>

Everything works "as it should". The page /moskva/auto/2 or /moskva/auto/3 displays the correct "portions" of entries and pagination links, with the correct active current page. But the links in the pagination block are not like this: /moskva/auto/3 (as we would like)... but like this: /?region=moskva&category=auto&page=3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mykola, 2017-09-20
@atillus

Put: the first rule

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question