Yes, Template Lite works on PHP 5 but its code itself is not PHP 5 compliant which is what Mark showed interest in porting it to.
Thanks,
On 9/22/06, Richard Thomas <[EMAIL PROTECTED]> wrote:
have attached the cote + example.. excuse the mess ;)
Richard Thomas wrote:
> I already extended and have it running under zend framework without any
> issue, it runs fine under php 5, although im not sure if I have estrict
> now that I think about it/
>
> its a mess right now but I can submit the work later to the list as an
> example at least.
>
> Shekar C Reddy wrote:
>> Hi All,
>>
>> I requested Mark Dickenson to try to port Template Lite to PHP 5 and
>> he showed interest. I gave him some info for coming up with a proposal:
>>
>> http://templatelite_forums.aatraders.com/viewtopic.php?f=2&t=3&sid=675c1e15c66b4302df38a25a864e4111
>> <http://templatelite_forums.aatraders.com/viewtopic.php?f=2&t=3&sid=675c1e15c66b4302df38a25a864e4111 >
>>
>>
>> Regards,
>
$view = new TemplateLite();
$view->setScriptPath($config->zend->views);
$view->addFilterPath($config->zend->filters);
$view->addFilter('Translate');
Zend::register('view', $view);
$view = Zend::registry('view');
$view->assign('_URLS_STATIC', _URLS_STATIC);
echo $view->render('layout/site.tpl.php');
class TemplateLite extends Zend_View_Abstract {
private $_tpl = false;
public function __construct() {
$config = Zend::registry('config');
require_once(_LIBS_OTHER.'/Template_Lite/class.template.php');
parent::__construct();
$this->setScriptPath($config->tpl_lite->compile_dir);
$this->_tpl = new Template_Lite;
$this->_tpl->compile_dir = $config->tpl_lite->compile_dir;
/* The real path is handled by the Zend Framework */
$this->_tpl->template_dir = '/';
}
protected function _run($template) {
$this->_tpl->display($template);
}
public function assign($var) {
if (is_string($var)) {
$value = @func_get_arg(1);
$this->_tpl->assign($var, $value);
} elseif (is_array($var)) {
foreach ($var as $key => $value) {
$this->_tpl->assign($key, $value);
}
} else {
throw new Zend_View_Exception('assign() expects a string or array, got '.gettype($var));
}
}
public function escape($var) {
if (is_string($var)) {
return parent::escape($var);
} elseif (is_array($var)) {
foreach ($var as $key => $val) {
$var[$key] = $this->escape($val);
}
return $var;
} else {
return $var;
}
}
public function render($name) {
return parent::render($name);
}
public function output($name) {
echo parent::render($name);
}
public function isCached($template) {
if($this->_tpl->is_cached($template)) {
return true;
}
return false;
}
public function setCaching($caching) {
$this->_tpl->caching = $caching;
}
}
