Il 18/01/2013 09:01, Roberto Giacomelli ha scritto:
> Hello,
> I'm interesting on the Falcon Template Document from a database
> reporting point of view.
> I wrote an example of a .ftd files that produces a LaTeX source:
> [code]
> % a very simple example...
> \documentclass{<? print(classname()) ?>}
> \usepackage[T1]{fontenc}
> \usepackage[utf8]{inputenc}
>
> \begin{document}
> Hello World!
> \end{document}
> <?
> function classname()
> return "article"
> end
> ?>
> [/code]
>
1) use the compiler module to load the module.
2) redirect output to a stringstream this way:
ss = StringStream()
out = stdOut(ss)
(out is the old standard stream)
3) invoke the main function of the loaded module.
4) ss.closeToString() should give you the output.
5) remember to stdOut(old)
The include() function is usually a viable shortcut for using the
compiler module.
For an extensive use of this technique see the nest.fal file in
frameworks/nest
Gian.