Hey all, ive been wondering if we couldnt make a change to the way templates
are rendered. If you look at the way this happens now, I think it's kinda
backwards. Normally a plugin would call output->parse() to load a template,
then inside the template add containers or objects to load data. Then this data
is usually created inside php with kind of ugly code like:
$out .= ''<div id="mydiv">';
This totally counteracts the reason for having templates!
Wouldnt it be possible to add an associative data array to the parse function:
$output->parse('my_plugin.my_template', $data);
All elements inside the data array then get changed to variables that are
usable inside the template.
$data = {
'my_array' =>array('1','2','3'),
'my_var' => $var
}
So in the template you can say:
-------
<div id="mydiv">
<ul>
<?= foreach($my_array as $somevar) : ?>
<li><?= $somevar ?></li>
<? endforeach; ?>
</ul>
</div>
-------
You can maybe do something similar using <roundcube:env..> but it seems no one
actually uses that.
Cor
_______________________________________________
Roundcube Development discussion mailing list
[email protected]
http://lists.roundcube.net/mailman/listinfo/dev