
486
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
<html>
<head>
<title>Select the Collection to Index</title>
</head>
<body>
<h2>Specify the index you want to build</h2>
<form method="Post" action="collection_index_action.cfm">
<p>Enter the collection you want to index:
<input type="text" name="IndexColl" size="25" maxLength="35"></p>
<p>Enter the location of the files in the collection:
<input type="text" name="IndexDir" size="50" maxLength="100"></p>
<p>Enter a Return URL to prepend to all indexed files:
<input type="text" name="urlPrefix" size="80" maxLength="100"></p>
<input type="submit" name="submit" value="Index">
</form>
</body>
</html>
2
Save the file as collection_index_form.cfm in the myapps directory under the
web_root
.
Note:
The form does not work until you write an action page for it, which you do when you index a collection.
Use cfindex to index a collection
1
Create a ColdFusion page with the following content:
<html>
<head>
<title>Creating Index</title>
</head>
<body>
<h2>Indexing Complete</h2>
<cfindex collection="#Form.IndexColl#"
action="refresh"
extensions=".htm, .html, .xls, .txt, .mif, .doc"
key="#Form.IndexDir#"
type="path"
urlpath="#Form.urlPrefix#"
recurse="Yes"
language="English">
<cfoutput>
The collection #Form.IndexColl# has been indexed.
</cfoutput>
</body>
</html>
2
Save the file as collection_index_action.cfm.
3
In the web browser, enter the following URL to display the form page:
http://
hostname:portnumber
/myapps/collection_index_form.cfm
4
Enter a collection name; for example, CodeColl.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...