Új hozzászólás Aktív témák

  • Lacces

    őstag

    Hali,

    Lehet valamit elfelejtettem, de mintha nálam nem működik az objektumok betöltése a PHP-nál... Nem tudom, hogy mi a gond :( (valamit kihagyok?)

    Mindegyik fájl egy mappában van!
    index.php (NetBeans alap generálás, mielőtt még valaki itt beszólna :DDD)
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    <?php
    error_reporting(E_ALL);

    $model = new Model();
    $controller = new Controller($model);
    $view = new View($controller, $model);
    echo $view->output();

    ?>
    </body>
    </html>

    class Model
    {
    public $string;

    public function __construct(){
    $this->string = "MVC + PHP = Awesome!";
    }
    }

    class Controller
    {
    private $model;

    public function __construct($model) {
    $this->model = $model;
    }
    }

    class View
    {
    private $model;
    private $controller;

    public function __construct($controller,$model) {
    $this->controller = $controller;
    $this->model = $model;
    }

    public function output(){
    return "<p>" . $this->model->string . "</p>";
    }
    }

    Pedig ennek alapból kellene működnie, nem? :R
    Semmi sem jelenik meg a böngészőben, az echo-k is csak az objektum létrehozása előtt jelennek, utólag nem.

Új hozzászólás Aktív témák