I have two controllers, one is base controller, other is subject
in the base controller I defined some arrays from Model, look:
class Controller_Base extends Controller_Template {
public $template = 'main';
public function before()
{
parent::before();
$webs = array();
$apps = array();
$app = new Model_Application();
$apps = $app->get_all();
$web = new Model_Web();
$webs = $web->get_all();
$this->template->content = '';
$this->template->styles = array('style');
$this->template->scripts = '';
$this->template->webs = $webs;
$this->template->apps = $apps;
}
}
in the controller subject I am using function in_array
class Controller_Subject extends Controller_Base {
public function action_all()
{
$url = $this->request->param('url');
$this->template->caption = $url;
if (in_array($url,$this->template->webs)) {
echo "web";
}
elseif (in_array($url,$this->template->apps)) {
echo "apps";
}
$links = array("a"=>"1","b"=>"2");
$view = View::factory('subject')
->set('links',$links);
$this->template->content = $view;
}
}
but the Kohana returns me an error:
ErrorException [ Warning ]: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument
Whats wrong?