title: How to call function from Controller to include into the View page with Codeigniter?
body: <p>I want to call function from Controller to include into the View page with Codeigniter. Usually when I open any page, I call $this->load->view() in Controller for open that page. Now I want to include sub page into main page, but it can't include any function in View. I try to include function like this.</p>
  
  <pre><code>&lt;body&gt;&lt;? include(site_url().'/login'); ?&gt;&lt;/body&gt;
  
  &lt;body&gt;&lt;? include('/login'); ?&gt;&lt;/body&gt;
  
  &lt;body&gt;&lt;? include('./login'); ?&gt;&lt;/body&gt;
  </code></pre>
  
  <p>I can open page with this link <a href="http://localhost/ci_house/index.php/login" rel="nofollow">http://localhost/ci_house/index.php/login</a>. but when I open main page for run my code it show these error.</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Warning
  
  Message: include(http://localhost/ci_house/index.php/login) [function.include]: failed to open stream: no suitable wrapper could be found
  
  Filename: views/main.php
  
  Line Number: 8
  A PHP Error was encountered
  
  Severity: Warning
  
  Message: include() [function.include]: Failed opening 'http://localhost/ci_house/index.php/login' for inclusion (include_path='.;C:\php5\pear')
  
  Filename: views/main.php
  
  Line Number: 8
  </code></pre>
  
  <p>I want to show 2 view in 1 page .  </p>
  
  <pre><code>function test1()
  { $data['var_for_login_view'] = 'get table1';
    $this-&gt;load-&gt;view('main1',$data);
  }
  function test2()
  { $data['var_for_login_view'] = 'get table2';
    $this-&gt;load-&gt;view('main2',$data);
  }
  </code></pre>
  
  <p>In views/main.php:</p>
  
  <pre><code>$this-&gt;load-&gt;view('test1');
  $this-&gt;load-&gt;view('test2');` 
  </code></pre>
  
  <p>I want to show like </p>
  
  <pre><code>&lt;body&gt;
  include('main1.php');
  include('main2.php');
  &lt;/body&gt;
  </code></pre>
  
  <p>but I can show like this in Codeigniter.</p>