How to get data in function extend controller?
<p>My controller is like this:</p>

<pre><code>&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Dashboard extends EX_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $this-&gt;data['news'] = $this-&gt;dashboard_model-&gt;get_news();
        $this-&gt;load-&gt;view('dashboard/index_view', $this-&gt;data);
    }
</code></pre>

<p>My EX_Controller is like this :</p>

<pre><code>&lt;?php
class EX_Controller extends CI_Controller
{
    public $data;
    public function __construct()
    {
        parent::__construct();

        $this-&gt;load-&gt;model('notification_model');
        $this-&gt;get_notification();
    }

    public function get_notification()
    {
        $session = $this-&gt;session-&gt;userdata('login');
        $this-&gt;data['notification'] = $this-&gt;notification_model-&gt;get($session);
        $this-&gt;data['count_notification'] = $this-&gt;notification_model-&gt;get_count_notification($session['customer_id']);
    }
}
?&gt;
</code></pre>

<p>My index view is like this :</p>

<pre><code>&lt;?php
    foreach ($notification as $value) {
?&gt;
        &lt;li&gt;
        &lt;?php
            echo '&lt;a href='.base_url().'notification/notif/'.$value['notification_id'].'&gt;';
        ?&gt;
                &lt;span class="time"&gt;
                &lt;?php 
                    echo time_elapsed($value['notification_created_date']); 
                ?&gt;
                &lt;/span&gt;
                &lt;span class="details"&gt;
                    &lt;span class="label label-sm label-icon label-info"&gt;
                        &lt;i class="fa fa-bookmark"&gt;&lt;/i&gt;
                    &lt;/span&gt; &lt;?php echo $value['notification_message']; ?&gt;
                &lt;/span&gt;
            &lt;/a&gt;
        &lt;/li&gt;
&lt;?php
    }
?&gt; 
</code></pre>

<p>When executed, there exist error :</p>

<pre><code>Message:  Undefined variable: count_notification
Message:  Undefined variable: notification
</code></pre>

<p>It seems it can not call get_notification function in EX Controller</p>

<p>I put in function <code>get_notification(EX Controller)</code> to be read in all controllers</p>

<p>Any solution to solve my problem?</p>