Hi Ralph
Indeed, a pluggable adapter would be ideal. Presently the MVC team
has been focussing on routing, requests and how to extend the
functionality of 'pages' for the controller, but since the current
View architecture has been relatively stable and flexible there's not
been much need to visit the code. But this would be a worthy
addition, and we should see if this can be slotted in to the next
milestone (after 0.2). I suggest you join the MVC list on fw-
[EMAIL PROTECTED] and we can initiate the discussions ASAP
Cheerio - looking forward to the next draft of Zend_Session, too! :)
Simon,
I am very much interesting in seeing this functionality...
Specifically, I would like to see a pluggable adapter approach to
templating... When Zend_Session gets into the incubator, I will
have time to donate to this effort.
I was asking (a day or two ago) who would be the best person to
talk to about Zend_View as getting an api ready to accept pluggable
'template engines' would be an ideal solution to ending the smarty
vs. php-only-template arguments on the list.., anyone know who is
the Zend_View person or people are?
As Andi said, there exists a good argument for any templating
solution based on the consuming team, resources, and/or needs.
Perhaps default behavior is php-coded-templates with an option to
do the following:
$view = new Zend_View();
//optional code:
// implementation of engine interface
$tl = new Zend_View_Engine_TemplateLite();
$tl->setCompilesDirectory(...);
$tl->addPluginDirectory(...);
$view->setTemplateEngine($tl);
$view->display('templateLiteStyle.tpl');
-ralph
Simon Mundy wrote:
FWIW I wrote a _very_ simple Smarty parser that actually turns the
templates into native Zend_View files. I've been meaning to work
on it some more but things are pretty tight at the moment. It only
performs variable replacement, includes and variable modifiers
currently, but I was looking to extend it to provide 60-80% of
current Smarty functions and make the parser more robust and more
PHP5-like (allow chaining properties/methods etc).
Is anyone interested in seeing it so far? It's only a proof-of-
concept but could perhaps spark something if anyone's interested
in improving/extending it?
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]
<mailto:[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>
>>
<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;
}
}
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3
9654 4124
http://www.peptolab.com
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com