tag encloses an entire template. It provides the basic information
about the type of template you want it to be, as well as the query
info. All attributes (unless specified) are relevant to all template
Type of tag: Open/close
display | edit | add | mass-editDefault:
Indicates what kind of template you want to show. Display will only
display values, nothing else. Edit
will allow the user to edit or
delete values (see the
for info on how to differentiate between allowing the user to edit each
row separately or all rows at once). Add
will allow the user to
insert a new row into tables, but not to see existing ones.
Note that if you use the
will automatically be set to
(i.e. this attribute will be ignored).
Mass-edit is not required
for regular templates (Sparse will change edit types to mass-edit types if it detects
an update button
but is required for quick templates.
Values: A valid database
the "use db;" command in mySQL, this selects the default database for
the query. It's not required if you pass a MySQL connection directly to
Sparse when you call
Required: Only if
query is not set
Values: The "table_references" for your SQL query.
Simple enough, just list the tables you want to deal with. You can use
the AS keyword for aliases, and can separate the tables by commas or
JOIN keywords etc.
Required: Only if
tables is not set
Values: Any valid SQL query
can create a template with a direct query using this attribute. This
allows for very complex queries, but the advanced functionality won't
be available - you can only use a
Values: An integer number greater than 1. Note that this does not support "LIMIT
10, 15" syntax.
will allow you to limit the number of rows you want to display. In
other words, this is the number of rows which will be displayed per
page. You can add "Previous/Next" buttons using the
to allow the user to navigate around the rows. Note that this attribute
can be used even if you have a query
rather than table
Values: Any valid WHERE/ORDER BY/GROUP BY/HAVING clause (all together).
This is the remainder of the query. See Templates
And Queries for more info. This attribute is ignored if you
have a query rather
Values: Valid positive integer
templates, which have no data, you can indicate how many new
rows the user can insert at once by setting this attribute (e.g. if
rowsToAdd is 5,
the user will be shown 5 rows to insert). By default this is 1.
Values: A comma-delineated list of table aliases
If your query has multiple tables, deleting a row from the template
will delete the row
of the tables. To avoid this behavior, put a list of tables
in this attribute; only
tables will have their rows deleted. Note that you should use the
resolved name of the table; if you used an alias to define the table,
use the alias here.