You do not need to use javascript. There are examples for fpTemplate on
how to do this. See .../packages/fcl-base/texts/fptemplate.txt for details.
Examples are in .../packages/fcl-web/examples/fptemplate/...
All your logic (loop) can be in your fpc source code for grids.
What you seem to want is something php-like, to interpret commands from
the html template. But that way the program logic and display template
would not be separate.
AB
On 9/16/2014 21:51, luciano de souza wrote:
Hello all,
I Know two templating engines for Freepascal: FPTemplate e JTemplate.
Both can be successfully used for html construction.
But they presents the same aspect: only searches and replaces tags to values.
Of course, it's crucial. But to show html grids, obtained from
database queries, it would be better if the templating engine had
support for logical structures. Something like:
<table>
<%
for row in rows do
begin
write('<tr>');
for cell in cells do
writeln('<td>%s</td>', [cell]);
write('</tr>');
end;
%>
</table>
It's only an example. The engine can use a syntax different from Pascal.
But what I really like is not to use Javascript. Yes, in the Pascal
side, I could write a JSON and certainly, there would be several
Javascript libraries to show a grid from a JSON. However, I would like
a pure Pascal solution.
Are there templating engines in Pascal with support for logical structures?
Regards,
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal