开发者

Why can't Kohana find my controller?

I have the following controller:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Static extends Controller_DefaultTemplate {

    public function action_index()
    {
        View::set_global('message', '<span class="highlight">This is a global message.</span>');

        $data = array (
            'siteTitle' => 'Kohana Test Site',
            'siteSubtitle' => 'A site to learn Kohana',
            'menu' => View::factory('blocks/menu'),
      开发者_JS百科  );

        $view = View::factory('templates/layout', $data);
        $this->request->response = $view->render();
    }

} 

but kohana gives me the error:

ErrorException [ Fatal Error ]: Class 'Controller_DefaultTemplate' not found

although Eclipse can find the file (via F3) and I thought Kohana was able to find all classes via autoloading?

Why can't Kohana find my controller?

How can I get Kohana to find the Controller_DefaultTemplate class so I can extend Controller_Static?


You must include file with definition of Controller_DefaultTemplate


The problem was that my file name defaultTemplate.php was camel case, changing it to all-lowercase defaultemplate.php enabled Kohana to find the class inside it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜