mvc-base/Classes/Controller.php

24 lines
489 B
PHP
Executable File

<?php
abstract class Controller{
protected $request;
protected $action;
public function __construct($action, $request){
$this->action = $action;
$this->request = $request;
}
public function executeAction(){
return $this->{$this->action}();
}
protected function returnView($viewmodel, $fullview){
$view = 'Views/'. get_class($this). '/' . $this->action. '.php';
if($fullview){
require('Views/main.php');
} else{
require($view);
}
}
}