/lib/Milk/Views/BaseView.php

https://github.com/geekbuntu/milk · PHP · 30 lines · 23 code · 7 blank · 0 comment · 2 complexity · cf51a203b0e983c0fe133d91a2a3a3a7 MD5 · raw file

  1. <?php
  2. namespace Milk\Views;
  3. use \F3 as F3;
  4. class BaseView {
  5. protected $method;
  6. protected $request;
  7. protected $query;
  8. public function __construct() {
  9. $this->method = $_SERVER['REQUEST_METHOD'];
  10. $req = explode('/', $_SERVER['REQUEST_URI']);
  11. array_shift($req);
  12. $this->request = $req;
  13. $this->query = $_SERVER['QUERY_STRING'];
  14. }
  15. public function __call($name, $arguments) {
  16. if (!method_exists($this, $name))
  17. if (!F3::get('RELEASE'))
  18. trigger_error("View $name does not exist in ".get_class($this));
  19. else
  20. F3::http404();
  21. return $this->fields[$args[0]];
  22. }
  23. }