How to use pagination almost everywhere?

Hi there

I want to use pagination in almost all methods with default value for limit and offset variables. Top it off, I want to be able to disable that pagination in some methods.

How can i implement that?

Thanks in advance.

Salam haji,

If you want to set default values for components, you need to look into using containers: -

http://www.yiiframework.com/doc-2.0/guide-concept-di-container.html

An example would be to have a container settings file such as this in your config folder: -




<?php


    \Yii::$container->set('yii\widgets\ActiveField', [

        'inputOptions' => ['class' => 'form-control', 'prompt' => 'Select'],

    ]);


?>



Then to call this file in your index.php after you have included the framework: -




require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');

$application = new yii\web\Application($config);

require(__DIR__ . '/../config/container.php');



Khodafez!