[htmltmpl] retrieving default values
Brought to you by:
samtregar
|
From: Marcel v. D. <ma...@va...> - 2011-11-17 17:29:52
|
Hi list,
I'm new here, so please be kind.
I would like to retrieve the default value from the template, eg.
TMPL_VAR NAME="VAR1" DEFAULT="DEFAULTVALUE1"
I would like to process this value, but
my $value = $tpl->param('VAR1');
does not give me the value "DEFAULTVALUE1"
I cannot find another way to get the value eg: $tpl->query
Basically I would like to write a sub, which retrieves an LDAP filter
from the template, and fills the template with the values retrieved. The
TMPL_VAR name should be the same as the attribute name. With multiple
value attributes you will need a TMPL_LOOP (otherwise you only get the
first value).
This would greatly simplify my code, as I fill lots of templates with
different LDAP filters.
(as a sidenote: this should not be too difficult to extend to SQL
queries as well).
I can achieve this with hidden form fields, but I do not want or need
the info in the (HTML) output. Also I will lose the scoping of the
variables, which is in fact very convenient.
Another approach is to add eg. TMPL_PARAM, but I am not that good a
programmer that I can extend a module like HTML::Template
Can anyone help?
Marcel
|