title: using a common layout for several modules in Yii
body: <p>I am using Yii framework in my web project. now, I have several modules and I want to use only one layout for all modules. I have used following codes for determining the layout for every controller/action in each module:</p>
  
  <pre><code>$this-&gt;layoutPath = Yii::getPathOfAlias('application.views.layouts');
  $this-&gt;layout = '//layouts/myLayout';
  </code></pre>
  
  <p>Is there any other solution to do this by using same code in init() function of each module?
  in other word, I have to write the above 2-line code in each action and i think it's not good and i want to reduce my number of lines of codes. for example as follows:</p>
  
  <pre><code>class StaffModule extends CWebModule
  {
      public $layout;
      public $layoutPath;
      public function init()
      {
          $this-&gt;layoutPath = Yii::getPathOfAlias('application.views.layouts');
                  $this-&gt;layout = '//layouts/myLayout';
          $this-&gt;setImport(array(
              'staff.models.*',
              'staff.components.*',
          ));
      }
  }
  </code></pre>
  
  <p>but it doesn't work. Help me please.</p>