KHN自带例子中的viewinview例子无法执行..
http://xxx/index.php/examples/template出错提示:
KHN2.1.1完全版中带来的例子,config.php已改
Runtime MessageAn error was detected which prevented the loading of this page. Ifthis problem persists, please contact the website administrator.
Undefined property:Examples_Controller::$load
Error occurred at line 5 of F:/easeyoo/KHN211All/application/views/viewinview/container.php.
Stack Trace[*]system\libraries\Controller.php :include( application\views\viewinview\container.php )[*]system\libraries\View.php :Controller_Core->_kohana_load_view( F:/easeyoo/KHN211All/application/views/viewinview/container.php, Array
(
=> View-in-View Example
=> This is my view-in-view page content.
=> © 2007 Kohana Team
=> View Object
(
=> F:/easeyoo/KHN211All/application/views/viewinview/header.php
=> .php
=> Array
(
=> View-in-View Example
=> This is my view-in-view page content.
=> © 2007 Kohana Team
)
)
)
)[*]application\controllers\examples.php :View_Core->render( 1 )[*]system\core\Kohana.php :Examples_Controller->template()[*]Kohana::instance()[*]system\core\Event.php :call_user_func( Array
(
=> Kohana
=> instance
)
)[*]system\core\Bootstrap.php :Event::run( system.execute )[*]index.php :require( system\core\Bootstrap.php )Loaded in 0.0891 seconds, using 0.85MB of memory. Generated by Kohana v2.1.1. 出错提示的是一个view页面里的:
<?php
$this->load->view("....")
?>
语句.. $this->load() 的用法已经被取消了。
我测试了一下,需要做如下修改:
在 controllers/examples.php 里,将:
$view = $this->load->view('viewinview/container', $data);
$view->header = $this->load->view('viewinview/header', $data);
修改为:
$view = new View('viewinview/container', $data);
$view->header = new View('viewinview/header', $data);
在 views/viewinview/container.php 里,将最后一行修改为:
<?php echo new View('viewinview/footer', array('copyright' => $copyright )) ?>
要注意的是,$this->load() 的用法已经被取消,所以你装在libraries和helpers时,也统一用标准的PHP语法(即,new Class())。
页:
[1]