sqlfield
s are automatically forced to only
display the data. You can still use navigational buttons to go back and
forth between data.<?php
include('Sparse.php');
SparseThisPage('username', 'password');
?>
<html>
<sqltemplate type="display" tables="employees"
limit="10" database="myDB">
<table border="1">
<sqlrow>
<tr>
<td><sqlfield name="employeeID"
/></td>
<td><sqlfield name="employeeName"
/></td>
</tr>
</sqlrow>
<tr><td colspan="2"
align="center">
<sqlaction type="prev"
/><sqlaction type="next" />
</td></tr>
</table>
</sqltemplate>
</html>
15 | Jack Brown |
17 | Jane Smith |
18 | Terry Pratchett |
23 | Malcolm X |
27 | George Bush |
100 | Joan of Arc |
104 | Feivel Mousekowitz |
150 | Guy Fawkes |
200 | Baron Saturday |
4567654 | Bill Gates |
<?php
include('Sparse.php');
SparseThisPage('username', 'password');
?>
<html>
<sqltemplate type="add" table="employees"
rowsToAdd="2" database="myDB">
<table border="1">
<sqlrow>
<tr>
<td><sqlfield name="employeeID"
/></td>
<td><sqlfield name="employeeName"
type="textarea" rows="1" cols="10"/></td>
</tr>
</sqlrow>
<tr><td colspan="2"
align="center">
<sqlaction
type="add" />
</td></tr>
</table>
</sqltemplate>
</html>
sqlfield
tag.) You can also make regular text
fields use checkboxes, radio boxes, or select boxes by utilizing enumsets. You can even turn the field into plain
old text (although that's pretty useless for add
or edit templates).<?php
include('Sparse.php');
SparseThisPage('username', 'password');
?>
<html>
<sqltemplate type="edit" table="employees" database="myDB"
limit="10">
<table border="1">
<sqlrow>
<tr>
<td><sqlfield name="employeeID"
/></td>
<td><sqlfield name="employeeName"
type="textarea" rows="1" cols="10"/></td>
<td><sqlaction type="edit"/>
<sqlaction type="delete" /></td>
</tr>
</sqlrow>
<tr><td colspan="3">
<sqlaction type="prev"/><sqlaction
type="next"/>
</td></tr>
</table>
</sqltemplate>
</html>
|
|||
<sqlaction type="edit" />
outside the sqlrow
tag. Doing this will ignore any sqlaction
tags that are inside the sqlrow
.
You will also not be able to delete any rows using this method.
Unfortunately, there is no way to allow both methods to operate at once
without using Javascript, which we'd rather not do for the moment in an
effort to make Sparse as universal as possible.Previous: Templates and Queries | Template Types | Next: Advanced Queries