[Lazarus] Lazarus CGI Sample
ABorka
fpc-devel at aborka.com
Thu May 27 23:08:53 CEST 2010
On 5/27/2010 13:52, Leonardo M. Ramé wrote:
> On the other hand, fpWeb has a more advanced templating engine, that
> maybe (I don't tested it) allows one to create rows of an HTML table
> right from the template, without creating it inside the program's code.
Yes, this is true. See the demo program under your Lazarus diretory
/components/fpweb/demo/fptemplate/listrecords/
You can use a tag in your template and complete eliminate html code in
your pascal code. From the above demo program the template file contains:
{+REPORTRESULT
[-HEADER=
<table bordercolorlight="#6699CC" bordercolordark="#E1E1E1"
class="Label">
<tr class="Label" align=center bgcolor="#6699CC">
<th><font color="white">~Column1</font></th>
<th><font color="white">~Column2</font></th>
</tr>
-]
[- ONEROW =
<tr bgcolor="#F2F2F2" class="Label3" align="center">
<td>~Column1Value</td><td>~Column2value</td>
</tr>
-]
.
.snip, and so on more parameters if needed
.
[- NOTFOUND=
<tr class="Error"><td>There are no entries found.</td></tr>
-]
[-FOOTER= </table>-]
+}
This is a single template tag with tag parameters to generate a full
html table as you please. In the above example the pascal module only
replaces the actual values in the table header and rows (marked by tilde
"~").
AB
More information about the Lazarus
mailing list