title: Calling a model in a Helper file using codeigniter
body: <p>I want to write a function for loading dropdown in helper file and for that reason I want to Use my models in Helper file.</p>
  
  <p>When I use this it give me the error:</p>
  
  <pre><code>$this-&gt;load-&gt;model("news_model");
  </code></pre>
  
  <p>The Error:</p>
  
  <pre><code>Fatal error: Using $this when not in object context in C:\xampp\test\application\helpers\component_helper.php on line 6
  </code></pre>
  
  <p>my method:</p>
  
  <pre><code>function dropdown($Class,$Attribute)
  {
  $Output=NULL;
  $ClassName=$Class."_model";
  $this-&gt;load-&gt;model($ClassName);
  $FullData=$ClassName-&gt;get();
  foreach ($FullData as $Data) 
  {
      $Output.='&lt;option value="'.$Data-&gt;Id.'"&gt;'.$Data-&gt;$Attribute.'&lt;/option&gt;';
  }
  return $Output;
  }
  </code></pre>
  
  <p>Thanks</p>