Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Abstract class to define controllers.
  5. * CANNOT BE INSTANTIATED, MUST BE EXTENDED
  6. **/
  7. abstract class Controller {
  8.  
  9. protected $template; //Will be inherited by child classes
  10. protected $subView;
  11.  
  12. /**
  13. * Class constructor. Constructor accepts parameter to allow state overloading
  14. * Multiple different states can have the same controller.
  15. **/
  16. function __construct($template, $subView = false){
  17. $this->template = $template;
  18. $this->subView = $subView;
  19. ob_start();
  20. $this->render();
  21. }
  22.  
  23. function render(){
  24. include($this->template); //import the template into the controller which will render it
  25. }
  26. }
  27.  
  28. ?>
  29.  
  30.  
  31. <?php
  32.  
  33. class Test extends Controller {
  34.  
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement