The following code is generating a page not found error with Kohana 2.3.4
class Search_Core
{
public function result($term)
{
$this->search->title = "Search Results";
$this->search->content = View::factory("search_view");
$test = $this->pleaseWork("This should be on the screen");
$this->search->content->test = $test;
return $this->search;
}
public function pleaseWork($word)
{
$dude = $word;
return $dude;
}
}
I’ve called methods within methods of the same class before, but for some reason this is not working. I can replace the $test variable with something like this:
$test = "a bunch of random words";
And it will work no problem. I can write something similar outside of Kohana and it will work, but this is not and I can’t fgure out why. The $test variable is in the search_view view and as I demonstrated, it works find if I supply a string as opposed to calling a method.
The error is on Kohana.php line# 841.
I was able to get this to work by using
instead of the original
However, I would still like to know why it didn’t work originally. Does it have something to do with this being a library that I’m calling from a controller? I can’t imagine why as the $this should be referencing the library.