fields
attribute
introduced in the previous section, Sparse can recreate an entire
template just from the sqlquick
tag. This tag is primarily identical to sqltemplate.
An example: <sqlquick type="edit"
database="myDB"
fields="employeeID, e.name, m.name AS mname,
concat(e.address, e.city) AS address"
tables="employees AS e, managers AS m"
limit="10"
constraints="WHERE e.managerID=m.id AND mname != 'John
Smith'">
<sqltemplate database="myDB"
type="edit" tables="employees AS e,
managers AS m"limit="10" constraints="WHERE e.managerID=m.id AND
mname != 'John Smith'">
<table>
<tr>
<th>employeeID</th>
<th>name</th>
<th>mname</th>
<th>address</th>
<th>Action</th>
</tr>
<sqlrow>
<tr>
<td><sqlfield name="employeeID"
/></td>
<td><sqlfield name="e.name"
/></td>
<td><sqlfield name="m.name AS
mname" /></td>
<td><sqlfield
name="concat(e.address, e.city) AS address" /></td>
<td><sqlaction type="edit"
/><sqlaction type="delete" /><sqlaction
type="reset"</td>
</tr>
</sqlrow>
<tr><td colspan="5"><sqlnavigation
/></td></tr>
</table>
</sqltemplate>
sqlfield
tag inside the sqlrow
tag. Correct sqlaction
tags are also added. Et voila! One tag gives you a full-fledged
template which allows you to edit, delete, and navigate through your
data!sqltemplate
tag. The best thing is to have a CSS
class that looks like this:table.template1 {border-collapse: collapse;}
table.template1 td, table.template1 th {border: 2px solid black;}
sqlrow
, but you don't have
that luxury here.)Previous: Advanced Queries | Quick Templates | Next: Enumsets