title: How to take get parameters for sorting items by category in Yii2?
body: <p>I use Yii2 advanced template. In my database table I have items with <code>categry</code> field (from 1.. to inf)</p>
  
  <p>Controller action:</p>
  
  <pre><code>public function actionIndex()
  {
      $searchModel = new AdsSearch();
      $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
      return $this-&gt;render('index', [
          'searchModel' =&gt; $searchModel,
          'dataProvider' =&gt; $dataProvider,
      ]);
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;?= ListView::widget([
      'dataProvider' =&gt; $dataProvider,
      'itemOptions' =&gt; ['class' =&gt; 'item'],
      'itemView' =&gt; '_item_view',,
  ]) ?&gt;
  </code></pre>
  
  <p>I have enabled prettyUrl</p>
  
  <pre><code>'urlManager' =&gt; [
              'enablePrettyUrl' =&gt; true,
              'showScriptName' =&gt; false,
          ],
  </code></pre>
  
  <p>And .htaccess in frontend/web/</p>
  
  <pre><code>RewriteEngine on
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . index.php
  </code></pre>
  
  <p>1) How can I show items that were find only by category?
  Now mysite.com/items shows all items with mixed categories
  I want to make mysite.com/items/cat/1 or mysite.com/items/1 that will show categories with <code>category = 1</code></p>
  
  <p>2) Is there any article how to make mysite.com/items/category-name-url instead number? I store category names in <code>$app-&gt;params</code>. Next item page with <code>id = 5</code> will be mysite.com/items/category-name-url/5 </p>