title: Yii - call an action method from another action method
body: <p>Title may be confusing, but here's explanation with code.</p>
  
  <p>Based on some conditions, 
  I may call <code>actionContact</code> even if user has called <code>actionIndex</code>.</p>
  
  <p><strong>Solution:1</strong>   </p>
  
  <pre><code> public function actionIndex()
      { 
          $a = 5;
          if($a == 5){
  
  
  $this-&gt;actionContact();
          }
          else{
              $this-&gt;render('index');
          }
      }
  
      public function actionContact()
      {
          // Some codes
          $this-&gt;render('contact');
      }
  </code></pre>
  
  <p><strong>Solution:2</strong> </p>
  
  <pre><code>public function actionIndex()
          { 
              $a = 5;
              if($a == 5){
  
  
  // Repeat code from actionContact method
              $this-&gt;render('contact');
          }
          else{
              $this-&gt;render('index');
          }
      }
  </code></pre>
  
  <p><strong>Solution:3</strong> I can redirect to contact url.</p>
  
  <p>I think, solution 1 works fine for me and I would prefer that. 
  But since I am new to yii, I would like to know, if its the way to go ?</p>