title: How to call function in controller from view in CodeIgniter?
body: <p><strong>My controller is like this :</strong></p>
  
  <pre><code>public function index()
  {
      $data_login = $this-&gt;session-&gt;userdata('login');
      $id = $data_login['customer_id'];
  
      $this-&gt;data['notification'] =  $this-&gt;get_data($id);    
  
      $this-&gt;load-&gt;view('notification/list_view', $this-&gt;data);
  }
  
  public function time_elapsed_string($datetime, $full = false) 
  {
      ...
  }
  </code></pre>
  
  <p><strong>My view (list_view) is like this :</strong></p>
  
  <pre><code>&lt;table class="table table-striped table-advance table-hover"&gt;
      &lt;tbody&gt;
      &lt;?php
          foreach ($notification as $key =&gt; $value) 
          {
      ?&gt;
  
          &lt;tr class="unread" data-messageid="1"&gt;
              &lt;td class="view-message "&gt; 
                  &lt;?php
                      echo '&lt;a href='.base_url().'notification/notif/'.$value['notification_id'].'&gt;'.$value['notification_message'].'&lt;/a&gt;&lt;br&gt;';
                  ?&gt;
              &lt;/td&gt;
              &lt;td class="view-message text-right"&gt; &lt;?php echo $this-&gt;time_elapsed_string($value['notification_created_date']); ?&gt; &lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;?php
          }
      ?&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>When executed, there exist error like this :</strong></p>
  
  <blockquote>
    <p>Fatal error: Call to undefined method
    EX_Loader::time_elapsed_string().....</p>
  </blockquote>
  
  <p>Seemed unable to call function <code>time_elapsed_string</code> in controller.</p>
  
  <p><strong>Any solution to solve my problem?</strong></p>