enumset
Tag
Attribute List:
This
tag outlines a set of enum
tags. It acts as a "switch" declaration. See enum
for more
details. It is available in all templates.
Note that you can also use the queryattribute
to directly grab data from your database into an enumset -
for example, getting all manager IDs and names. See below for details.
You can also include enumsets from separate files using the sqlinclude tag.
Type of tag: Open/close
Attributes
id
Required: Yes
Values: Any unique id
This will allow any field that references this enumset to use it.
query
Required: No
Values: Valid SQL query.
If this is included, the enumset data will be taken directly from the
SQL query given. This way you can leave the enumset
tag as a self-closing tag and you don't need any enum
tags. The first field returned from the query will be taken as the key
of each enum, and the second field as the value.
Example:
<enumset query="SELECT id, name FROM myDB.managers
ORDER BY name"/>
database
Required: No
Values: Valid MySQL database name.
Unless you passed SparseThisPage()
a MySQL
connection object, you might need this to make sure your query executes
properly.
ignoreCase
Required: No
Values: true | false
This is true by default. If set to false, Sparse will check for
the enum keys in a case-sensitive manner. In other words, the following
is possible:
<enumset id="enum1">
<enum key="t" value="Tab" />
<enum key="T" value="Table" />
</enumset>
Note that this attribute will be ignored (hah!) if this is
a
"link" enumset (i.e. one with the src
attribute set). Instead, the
individual enumsets inside the linked file would have to have this
attribute set.