マイコントローラは次のようである:CodeIgniterのビューからコントローラ内の関数を呼び出す方法は?
<table class="table table-striped table-advance table-hover">
<tbody>
<?php
foreach ($notification as $key => $value)
{
?>
<tr class="unread" data-messageid="1">
<td class="view-message ">
<?php
echo '<a href='.base_url().'notification/notif/'.$value['notification_id'].'>'.$value['notification_message'].'</a><br>';
?>
</td>
<td class="view-message text-right"> <?php echo $this->time_elapsed_string($value['notification_created_date']); ?> </td>
</tr>
<?php
}
?>
</tbody>
</table>
実行されると、このようなエラーが存在する:
マイビュー(list_view)は次のようであるFatal error: Call to undefined method EX_Loader::time_elapsed_string().....
public function index()
{
$data_login = $this->session->userdata('login');
$id = $data_login['customer_id'];
$this->data['notification'] = $this->get_data($id);
$this->load->view('notification/list_view', $this->data);
}
public function time_elapsed_string($datetime, $full = false)
{
...
}
コントローラ内で機能time_elapsed_string
を呼び出すことができます。
私の問題を解決するための解決策はありますか?