• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
load->view calls function again

#1
[eluser]jordan314[/eluser]
Hi,
I'm trying to make a pagination function, but every time I load the view from the function it loads the function again. Any idea why?
public function sortby($sortmethod, $offset)
{
$this->jlog("DEBUG", "sortby called, got sortmethod: " . $sortmethod . ", offset: " . $offset);
if(!is_numeric($offset) || $offset < 1)
{
$this->jlog("ERROR", "invalid offset: " . $offset);
$offset = 0;
}
$data = Array(
'output' => ''
);
$this->jlog("DEBUG", "loading view...");
$this->load->view('homeview', $data);
}

When I load the URL /functions/sortby/1/2, I get this in my custom logs:
Tue, 02 Aug 2011 06:14:21 -0700 functions.php [DEBUG] sortby called, got sortmethod: 1, offset: 2
Tue, 02 Aug 2011 06:14:21 -0700 functions.php [DEBUG] loading view...
Tue, 02 Aug 2011 06:14:21 -0700 functions.php [DEBUG] sortby called, got sortmethod: 1, offset: img
Tue, 02 Aug 2011 06:14:21 -0700 functions.php [DEBUG] loading view...

If I comment out $this->load->view then the function does not get called twice (but obviously nothing displays). It's also weird that the function is getting called again with an HTML element as the second parameter. Any idea why?

Thanks, J

#2
[eluser]Aken[/eluser]
Post the contents of your view, and please use the code tags.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.