Welcome Guest, Not a member yet? Register   Sign In
Run another controller's method
#26

[eluser]metaltapimenye[/eluser]
model. thats to simplify the answer.

"put a method in a controller" that was a problem here. just put your method in model part. thats why CI running MVC at the first stone.

controller
Code:
function thread($par1,$par2){
$this->load->view('template/thread');
}

model:
Code:
function recent_post($top_limit){
  #..fetching recent post
}
function recent_comment($top_limit){
  #..fetching recent coment
}
function related_thread($string_to_relate,$limit){
  #..fetching related thread
}
view:
Code:
<?php $this->load->model('fetcher_model','model');?>
<body>
    <div class="sidemenu">
      <h2>Recent posts</h2>
      &lt;?php echo $this->model->recent_post('10');?&gt;
      <h2>Recent comments</h2>
      &lt;?php echo $this->model->recent_comment('10');?&gt;
       <h2>Recent comments</h2>
      &lt;?php echo $this->model->related_thread($row['current_title'],5);?&gt;
    </div>
    <div class="content">
      &lt;?=$content?&gt;
    </div>
  &lt;/body&gt;


Messages In This Thread
Run another controller's method - by El Forum - 02-13-2008, 03:50 AM
Run another controller's method - by El Forum - 02-13-2008, 06:01 AM
Run another controller's method - by El Forum - 02-13-2008, 07:00 AM
Run another controller's method - by El Forum - 02-13-2008, 07:03 AM
Run another controller's method - by El Forum - 02-13-2008, 10:50 AM
Run another controller's method - by El Forum - 02-13-2008, 11:02 AM
Run another controller's method - by El Forum - 02-13-2008, 10:18 PM
Run another controller's method - by El Forum - 02-13-2008, 11:23 PM
Run another controller's method - by El Forum - 02-15-2008, 11:34 AM
Run another controller's method - by El Forum - 02-15-2008, 11:51 AM
Run another controller's method - by El Forum - 02-15-2008, 02:53 PM
Run another controller's method - by El Forum - 02-15-2008, 03:01 PM
Run another controller's method - by El Forum - 02-15-2008, 06:42 PM
Run another controller's method - by El Forum - 02-15-2008, 08:30 PM
Run another controller's method - by El Forum - 02-15-2008, 08:34 PM
Run another controller's method - by El Forum - 02-15-2008, 10:24 PM
Run another controller's method - by El Forum - 02-16-2008, 06:44 AM
Run another controller's method - by El Forum - 05-19-2009, 09:49 AM
Run another controller's method - by El Forum - 05-19-2009, 10:14 AM
Run another controller's method - by El Forum - 05-19-2009, 07:28 PM
Run another controller's method - by El Forum - 05-20-2009, 02:09 AM
Run another controller's method - by El Forum - 05-20-2009, 02:10 AM
Run another controller's method - by El Forum - 05-20-2009, 02:35 AM
Run another controller's method - by El Forum - 05-20-2009, 09:19 AM
Run another controller's method - by El Forum - 07-03-2010, 06:51 PM
Run another controller's method - by El Forum - 07-04-2010, 08:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB