Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Abstract class to define controllers.
- * CANNOT BE INSTANTIATED, MUST BE EXTENDED
- **/
- abstract class Controller {
- protected $template; //Will be inherited by child classes
- protected $subView;
- /**
- * Class constructor. Constructor accepts parameter to allow state overloading
- * Multiple different states can have the same controller.
- **/
- function __construct($template, $subView = false){
- $this->template = $template;
- $this->subView = $subView;
- ob_start();
- $this->render();
- }
- function render(){
- include($this->template); //import the template into the controller which will render it
- }
- }
- ?>
- <?php
- class Test extends Controller {
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement