title: params in actionIndex giving Error 500, Undefined variable: id in YII
body: <p>I have added the code below in my actionView and actionIndex. The code works  code works fine when used in actionView, but throws me  Error 500,  Undefined variable: id, when used on actionIndex. Why variable id is undefined only on actionIndex? </p>
  
  <p>actionView ...</p>
  
  <pre><code>public function actionView($id)  
  {  
  
              $textDataProvider=new CActiveDataProvider('Text', array(  
          'criteria'=&gt;array(  
              'condition'=&gt;'articles_id=:articlesId',  
              'params'=&gt;array(':articlesId'=&gt;$this-&gt;loadModel($id)-&gt;id),  
          ),  
          'pagination'=&gt;array(  
              'pageSize'=&gt;1,  
          ),  
       ));  
      $this-&gt;render('view',array(  
          'model'=&gt;$this-&gt;loadModel($id),  
                      'textDataProvider'=&gt;$textDataProvider,  
  
      ));  
  }  
  </code></pre>
  
  <p>the same code, with only a small change for actionIndex ...</p>
  
  <pre><code>public function actionIndex()
  {       
  
          //get text information
          $textDataProvider=new CActiveDataProvider('Text', array(
          'criteria'=&gt;array(
              'condition'=&gt;'articles_id=:articlesId',
                               'params'=&gt;array(':articlesId'=&gt;$this-&gt;loadModel($id)-&gt;id),
                              'offset'=&gt;'0',
                              'limit' =&gt; '1',
  
  
          ),
          ));
          //get criteria
          $criteria = new CDbCriteria();
          //$criteria-&gt;condition = 'country = :country';
          //$criteria-&gt;params = array (':country'=&gt; $_GET['country']);
          $criteria-&gt;order = 'create_time desc';
  
          //get count
          $count = Articles::model()-&gt;count($criteria);
  
          //pagination
          $pages = new CPagination($count);
          $pages-&gt;setPageSize(10);
          $pages-&gt;applyLimit($criteria);
  
          //result to show on page
          $result = Articles::model()-&gt;findAll($criteria);
          $dataProvider = new CArrayDataProvider($result);
  
  
  
          $this-&gt;render('index', array(
      'dataProvider' =&gt; $dataProvider,
      'pages' =&gt; $pages,
          'textDataProvider'=&gt;$textDataProvider,
          ));
  
  
     }
  </code></pre>
  
  <p>I've maded a change to the actionIndex trying to get the id, as pointed out below. But I still can get the id.</p>
  
  <p>actionIndex ...</p>
  
  <p>public function actionIndex()
      {       </p>
  
  <pre><code>    //get criteria
      $criteria = new CDbCriteria();
      //$criteria-&gt;condition = 'country = :country';
      //$criteria-&gt;params = array (':country'=&gt; $_GET['country']);
      $criteria-&gt;order = 'create_time desc';
  
      //get count
      $count = Articles::model()-&gt;count($criteria);
  
      //pagination
      $pages = new CPagination($count);
      $pages-&gt;setPageSize(10);
      $pages-&gt;applyLimit($criteria);
  
      //result to show on page
      $result = Articles::model()-&gt;findAll($criteria);
      $dataProvider = new CArrayDataProvider($result);
  
  
      //$arr = array();
      foreach($result as $id)
      {
        $text_id = $id-&gt;id;
      }
  
       //get text information
      $criteria2=new CDbCriteria(array(                    
                              'order'=&gt;'id desc',
  
                              'condition'=&gt;'articles_id='.$text_id,
  
                      ));
  
      $textProvider=new CActiveDataProvider('Text', array(
          'criteria'=&gt;$criteria2,
  ));  
      $this-&gt;render('index', array(
      'dataProvider' =&gt; $dataProvider,
      'pages' =&gt; $pages,
      'textProvider'=&gt;$textProvider,
      ));
     }
  </code></pre>