For example, I use templates for email-newsletters.
At the moment I use for this the parser implementation on Tcl.
register.html looks like this: <p>Hello <? append output $vars(username)
?>!</p> ...
package require tclrivetparser
set text_for_parse [read_file [file join $::conf(template) {mail}
{register.html}]]
set output ""
::tclrivetparser::setoutputcmd {append output }
set data [::tclrivetparser::parserivetdata $text_for_parse]
eval $data
functions-> mail $vars(email) $vars(from) $vars(subj) $output
05.07.2013 14:57, Massimo Manghi wrote:
Something that would work like this?
set fragment "<?= [::rivet::xml \"a small template\" b] ?>"
puts [::rivet::parse_template $fragment]
<== puts -nonewline "<b>a small template</b>"
while
eval [::rivet::parse_template $fragment]
would actually evaluate the script and print to the browser the string
"<b>a small template</b>"
It implies some Tcl level interface to librivetparser. In don't know but
it could go into the rivetlib library rather than the core.
-- Massimo
On 07/04/2013 05:44 PM, Kirill Shtumf wrote:
One problem of the parser implementation is inability to add parsed text
into another variable. Command does not return a result and immediately
sends it to the stdout. Can we somehow change it?
--
With best regards,
Kirill
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org