Source for file TemplateFactory.class.php

Documentation is available at TemplateFactory.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."utilities/Template.class.php");
  4.  
  5. /**
  6. *
  7. * @package harmoni.utilities
  8. *
  9. * @copyright Copyright &copy; 2005, Middlebury College
  10. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  11. *
  12. * @version $Id: TemplateFactory.class.php,v 1.7 2007/09/04 20:25:54 adamfranco Exp $
  13. */
  14. class TemplateFactory {
  15. var $_paths;
  16. var $_ext="";
  17. function TemplateFactory($searchPath1) {
  18. if (!func_num_args()) {
  19. throwError(new Error("TemplateFactory - you must specify at least one search path.","TemplateFactory",true));
  20. }
  21. foreach (func_get_args() as $arg) {
  22. $this->_paths[] = $arg;
  23. }
  24. }
  25. function setExtension($ext) {
  26. $this->_ext = "." . ereg_replace("^\.","",$ext);
  27. }
  28. function newTemplate($name) {
  29. $obj = new Template($name.$this->_ext, $this->_paths);
  30. return $obj;
  31. }
  32. function catchTemplateOutput($name, $vars=array()) {
  33. $template =$this->newTemplate($name);
  34. return $template->catchOutput($vars);
  35. }
  36. }
  37.  
  38. ?>

Documentation generated on Wed, 19 Sep 2007 10:27:14 -0400 by phpDocumentor 1.3.0RC3