title: CodeIgniter - Calling a function from inside a view
body: <p>Is it possible to call a function which is located in a controller from a view?</p>
  
  <p>This is what i have in my controller, as an example</p>
  
  <pre><code>function checkKeyExists($userid, $key){
  }
  </code></pre>
  
  <p>Then inside my view i have the following</p>
  
  <pre><code>if(checkKeyExists($row-&gt;id, $role-&gt;key)){
  }
  </code></pre>
  
  <p>But when I run it, it says that checkKeyExists is not defined.</p>
  
  <p>If anyone can let me know how I could do this, that would be great.</p>