title: Rendering views in other places in Yii2 - no renderPartial?
body: <p>I need to render a partial view inside a custom component file in <code>Yii2</code> and according to the <a href="http://www.yiiframework.com/doc-2.0/guide-structure-views.html#rendering-in-other-places" rel="noreferrer">Yii docs</a> you can access the view instance via something like this:</p>
  
  <pre><code>\Yii::$app-&gt;view-&gt;renderFile('@app/views/site/license.php');
  </code></pre>
  
  <p>I went ahead and tried:</p>
  
  <pre><code>Yii::$app-&gt;view-&gt;renderPartial('//my/view/');
  </code></pre>
  
  <p>...but then got an error that I was trying to access a non-existent method.</p>
  
  <p>I then checked out the <a href="http://www.yiiframework.com/doc-2.0/yii-base-view.html" rel="noreferrer">view class</a> and noticed it doesn't have a <code>renderPartial</code> and this is a method of the <a href="http://www.yiiframework.com/doc-2.0/yii-base-controller.html" rel="noreferrer">controller</a> class instead.</p>
  
  <p>I see it has a <code>renderFile</code> method and a <code>render</code> method; which of these should I use?</p>
  
  <p>The docs don't state the <code>render</code> method includes the layout like the method of the same name from the <em>controller</em> class, so I'm not sure; as for <em>renderFile</em> I'm not 100% sure if that is suitable either?</p>
  
  <p>Could someone explain which method would produce the same results that <code>renderPartial</code> produces?</p>