
483
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
•
You do not want to expose the ColdFusion Administrator to users.
•
You want to create indexes on servers that you cannot access directly; for example, if you use a hosting company.
When using the
cfcollection
tag, you can specify the same attributes as in the ColdFusion Administrator:
You can create a collection by directly assigning a value to the
collection
attribute of the
cfcollection
tag, as
shown in the following code:
<cfcollection action = "create"
collection = "a_new_collection"
path = "c:\CFusion\verity\collections\">
If you want your users to be able to dynamically supply the name and location for a new collection, use the following
procedures to create form and action pages.
Create a simple collection form page
1
Create a ColdFusion page with the following content:
<html>
<head>
<title>Collection Creation Input Form</title>
</head>
<body>
<h2>Specify a collection</h2>
<form action="collection_create_action.cfm" method="POST">
<p>Collection name:
<input type="text" name="CollectionName" size="25"></p>
<p>What do you want to do with the collection?</p>
<input type="radio"
name="CollectionAction"
value="Create" checked>Create<br>
<input type="radio"
name="CollectionAction"
value="Optimize">Optimize<br>
<input type="submit"
name="submit"
value="Submit">
</form>
</body>
</html>
Attribute
Description
action
(Optional) The action to perform on the collection (create, delete, or optimize). The default value for the
action
attribute is
list
. For more information, see
cfcollection
in
CFML Reference
.
collection
The name of the new collection, or the name of a collection upon which you perform an action.
path
The location for the Verity collection.
language
The language.
categories
(Optional) Specifies that
cfcollection
create a Verity Parametric Index (PI) for this collection. By default, the
categories attribute is set to
False
. To create a collection that uses categories, specify
Yes
.