Лабораторная работа по "Программированию"
Автор: vouksu • Апрель 30, 2020 • Лабораторная работа • 291 Слов (2 Страниц) • 349 Просмотры
2) Write a search interface for files in the created collection
get criteria.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Get Criteria</title>
</head>
<body>
<form action="cfsearch.cfm" method="post">
<input type="text" name="criteria">
<input type="submit" value="Search">
</form>
</body>
</html>
cfsearch.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>cfsearch</title>
</head>
<body>
<cfsearch collection="mycollection" name="MyCriteria"
criteria="#criteria#">
<CFOUTPUT>
Search by keyword <b>#criteria#</b> returned
#MyCriteria.RecordCount# results <br>
</CFOUTPUT>
<CFOUTPUT QUERY="MyCriteria">
<a href="#MyCriteria.URL#"> #Title# </a><br>
</CFOUTPUT>
</body>
</html>
3) Create a search interface for the contents of articles collected in a table
ProgrammingCF Database News:
a) Register a collection with a ColdFusion administrator,
indexing the contents of the relevant database data
ProgrammingCF.
b) Write a search interface according to the data of the created collection.
a) Indexing database data ProgrammingCF.mdb.
(We connect the database in the administrator named MyDs.
Create a new collection called mycollect, and index it with data)
Indexing programmatically. Run the file indexDataBase.cfm.
indexDataBase.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Index Data Base</title>
</head>
<body>
<CFQUERY name="IndexNews" datasource="MyDs">
SELECT * FROM NEWS
</CFQUERY>
<CFIndex collection="mycollect" action="Update" type="Custom"
body="Title,Article" Key="ArticleID" Title="Title" Query="IndexNews">
Successfully.
</body>
</html>
б) The search interface for the data of the created collection:
We carry out a search.
Run the file sendform.cfm
sendform.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Send Form</title>
</head>
<body>
<form action="search.cfm" method="post">
<input type="text" name="criteria">
<input type="submit" value="Search">
</form>
</body>
</html>
search.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Search</title>
</head>
<body>
...