controller.class.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * Copyright (C) 2014 Jeroen De Meerleer <me@jeroened.be>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. * Description of model
  20. *
  21. * @author Jeroen De Meerleer <me@jeroened.be>
  22. */
  23. class controller {
  24. public $id;
  25. public $controller;
  26. public $method;
  27. function create_template($template, $model) {
  28. $tpl = new SpoonTemplate();
  29. $tpl->setForceCompile(true);
  30. $tpl->setCompileDirectory('compiled_templates');
  31. // assign some variables
  32. foreach($model as $key => $value) {
  33. $tpl->assign($key, $value);
  34. }
  35. // show the output, using 'template.tpl'
  36. $tpl->display("views/" . $template);
  37. }
  38. }