What do you mean by "proper template engine"? What roundcube has is
perfectly fine. There's no need to hunker down and rework the entire
code to use SMARTY or any other PHP templating system, or to use a
different one. The one we have works, and works well.
If you go back in the history of the list and search for a message
written by me about variable tags, I show you how to implement it. I'm
not sure of the exact date, or even what address it came from, but I
know I had it implemented to search almost every variable available.
Well, found the message (
http://lists.roundcube.net/mail-archive/dev/2006-08/0000128.html ) but
since the forum isn't up currently (still fighting with my provider)
it's not available. So here is a way to add the functionality you seek.
In /program/include/rcmail_template.inc if you scroll to around line 498
you should see an ending "case" block for the case "object". Just add
this after the "break;" and before the "}":
case 'var':
$var = $attrib['name'];
if(substr($var, 0, 1) == '$')
$var = substr($var, 1);
if(isset($$var))
{
if(is_array($$var))
return print_r($$var, true);
elseif(is_bool($$var))
return ($$var) ? 'true' : 'false';
else
return $$var;
}
else
{
global $$var;
if(isset($$var))
{
if(is_array($$var))
return print_r($$var, true);
elseif(is_bool($$var))
return ($$var) ? 'true' : 'false';
else
return $$var;
}
else
return $var.' was not found.';
}
break;
Then in your template, just add something like this: <roundcube:var
name="variableName" />
I tested with _SESSION and $_SESSION and both worked flawlessly ;) Hope
that helps. Maybe Thomas or Till will add this small feature in (after
they security check of course!!).
~Brett
Chris Fordham wrote:
On Fri, 14 Sep 2007 16:23:34 +1000, Thomas Bruederli <[EMAIL PROTECTED]>
wrote:
Jorge Asch wrote:
How would I print out a variable on a template.
Such a feature is not available yet. There are some hard-coded properties
like the username that you can access from within the template.
For example, I would like to display a text with the user's email
address, or display a text with the currently choosen language setting.
For the current user name it would be
<roundcube:object name="username" />
For a generic solution we could probably provide access to config, env
and
request variables using the same syntax as for contitional tags. You
could
then access the language something like this:
<roundcube:var name="env:language" />
But this still has to be implemented. We've also planned to enable PHP
code
in RoundCube templates.
Can you we use a proper template engine and no PHP, stick to principle?
Regards,
Thomas
_______________________________________________
List info: http://lists.roundcube.net/dev/
_______________________________________________
List info: http://lists.roundcube.net/dev/