class Controller_App extends Controller_Template { // Default session instance protected $_session; // Is the request ajax? protected $_is_ajax; public function __construct(Request $req) { // Pass the request to the template controller parent::__construct($req); // Set the template $this->template = 'template'; // Set the default session instance, this will be used throughout the application $this->_session = Session::instance(); // Is the request ajax? if (Request::$is_ajax OR $this->request !== Request::instance()) { $this->_is_ajax = TRUE; } } public function before() { if ($this->_is_ajax === TRUE) { $this->auto_render = FALSE; $this->request->headers['Cache-Control'] = 'no-cache, must-revalidate'; $this->request->headers['Expires'] = 'Sun, 30 Jul 1989 19:30:00 GMT'; $this->request->headers['Content-Type'] = 'application/json'; } else { parent::before(); $this->template->title = 'hello, world!'; $this->template->description = 'hello, world!'; $this->template->meta_keywords = 'hello, world!'; $this->template->meta_description = 'hello, world!'; $this->template->meta_description = 'hello, world!'; } } }
class Controller_User extends Controller_App { public function __construct(Request $req) { parent::__construct($req); } public function action_form() { $view = new View('form'); $this->template->content = $view->render(false); } }
I mam błąd:
Kod
Kohana_View_Exception [ 0 ]: The requested view could not be found
To co mnie zdziwiło to:
Kod
SYSPATH/classes\kohana\view.php [ 294 ] » Kohana_View->set_filename(arguments)
argumenty:
file bool FALSE
argumenty:
file bool FALSE
A gdy zamiast
$view = new View('form');
dam
$view = new View('form.php');
Jest
Kod
SYSPATH/classes\kohana\view.php [ 115 ] » Kohana_View->set_filename(arguments)
file string(8) "form.php"
file string(8) "form.php"
Ale nadal jest błąd
Kohana_View_Exception [ 0 ]: The requested view form.php could not be found
Widok na pewno istnieje.
Co o tym sądzicie ?
Zadziałało View::factory('form') -.-