Forum » Advanced Programming » Controllers...
What else?
Berichten: 1180
avatar
Online Stuur privebericht
Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

/**
 * @author Patrick rennings
 * @copyright 2010
 */

defined('SYSPATH') OR die('No Direct Script Access');

class 
Controller_Questionlist extends Controller {
    
    public function 
action_index() {
        
$ctemplate = new Controller_questionlist_template();
        
$ctemplate->Stap1('Question answering machine!');
    }
}

class 
Controller_questionlist_template extends Controller_Template {
    public 
$template 'index';
    
    public function 
Stap1 ($text) {
        
$this->template->message $text;
    }
    
}
?>

en de error:
Quote

ErrorException [ Recoverable Error ]: Argument 1 passed to Kohana_Controller::__construct() must be an instance of Kohana_Request, none given, called in /home/patrick/domains/noxxie.nl/public_html/junk/questionlist/application/classes/controller/questionlist.php on line 15 and defined



Dus het is niet mogelijk om te gaan extenden binnen je controller?
Laatst gewijzigd door Patrick op 2010-05-27 10:13:18
27-05-2010 10:13
Dit topic is 447 keer bekeken door 40 verschillende leden
Reacties op: "Controllers..."
1
Berichten: 2123
avatar
Offline Stuur privébericht
Controllers in Kohana hebben een argument in de constructor, namelijk de request.

Een fix zou denk ik zijn:
r. 13:
Code | Selecteer Alles
minimaliseren
1
$ctemplate = new Controller_questionlist_template($this->request);


Maar dit stukje code wat je geeft, is tegen alle regels van het MVC model in... Dus ik zou er voor gaan het anders op te bouwen.
27-05-2010 14:40
Reageer op: "Controllers..."
1
Je kan niet reageren omdat je niet bent ingelogd. Inloggen of Aanmelden