title: use variable from other function in same class codeigniter
body: <p>i'm newbie codeigniter programmer.</p>
  
  <p>i want to use function and all variable from this function to another function in same class controller. this my code</p>
  
  <pre><code>function page()
  {   
  
      $page_id = $this-&gt;uri-&gt;segment(3);
      $page_details = $this-&gt;m_module-&gt;submenu($page_id)-&gt;row_array();
      $data['title']= $page_details['sub_title'];
      $data['menu'] = $page_details['title'];
      $data['submenu'] = $page_details['sub_title'];
      $data['link'] = $page_details['sub_target'];
      $data['page_id'] = $page_id;
  }
  
  function employee()
      {
          $data['employee']= $this-&gt;m_module-&gt;employee()-&gt;result_array();
          $this-&gt;page();      
          $this-&gt;template-&gt;display($data['link'],$data);
      }
  </code></pre>
  
  <p>the problem is variable function page() can't call in function employee().</p>
  
  <p>this i get at browser</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined index: link
  
  Filename: controllers/Module.php
  
  Line Number: 39
  </code></pre>
  
  <p>please help.</p>
  
  <p>Thank you</p>