/** * Set template from source. * * Should be used only with temporary template sources. * Use setTemplate() or addSourceResolver() whenever possible. * * @param string $src The phptal template source. * @param string $path Fake and 'unique' template path. * @return $this */ public function setSource($src, $path = false) { PHPTAL::setIncludePath(); require_once 'PHPTAL/StringSource.php'; PHPTAL::restoreIncludePath(); if (!$path) { $path = PHPTAL_StringSource::NO_PATH_PREFIX . md5($src) . '>'; } $this->_prepared = false; $this->_functionName = null; $this->_codeFile = null; $this->_source = new PHPTAL_StringSource($src, $path); $this->_path = $path; return $this; }
/** * Ensures that $this->groups works. * * Groups are rarely-used feature, which is why they're lazily loaded. */ private function initializeGroups() { if (!$this->uses_groups) { if (!class_exists('PHPTAL_RepeatControllerGroups')) { PHPTAL::setIncludePath(); require_once "PHPTAL/RepeatControllerGroups.php"; PHPTAL::restoreIncludePath(); } $this->groups = new PHPTAL_RepeatControllerGroups(); $this->uses_groups = true; } }
/** * PHPTAL templating engine * * PHP Version 5 * * @category HTML * @package PHPTAL * @author Laurent Bedubourg <*****@*****.**> * @author Kornel Lesiński <*****@*****.**> * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: FileSourceResolver.php 731 2009-09-25 16:31:56Z kornel $ * @link http://phptal.org/ */ PHPTAL::setIncludePath(); require_once 'PHPTAL/SourceResolver.php'; PHPTAL::restoreIncludePath(); /** * Finds template on disk by looking through repositories first * * @package PHPTAL */ class PHPTAL_FileSourceResolver implements PHPTAL_SourceResolver { public function __construct($repositories) { $this->_repositories = $repositories; } public function resolve($path) { foreach ($this->_repositories as $repository) { $file = $repository . DIRECTORY_SEPARATOR . $path;