home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Examples / store / search.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  2.6 KB  |  102 lines

  1. <!--- Please ignore this code... it checks whether the online
  2.     store's Verity collection exists, and if not, creates it.
  3.  
  4.     You wouldn't have to do this, instead you would use the
  5.     Cold Fusion administrator to create your collection. --->
  6.  
  7. <CFREGISTRY ACTION=GETALL Branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Collections" 
  8.     Type="KEY"
  9.     Name="Collections">
  10. <CFSET CollectionFound = 'No'>
  11. <CFLOOP QUERY="Collections">
  12.     <CFIF Collections.Entry IS 'CFexamples'>
  13.         <CFSET CollectionFound = 'Yes'>
  14.     </CFIF>
  15. </CFLOOP>
  16. <CFIF CollectionFound IS 'No'>
  17.     <!--- Create the collection --->
  18.     <CFREGISTRY ACTION=GET Branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Collections"
  19.                 Entry="RootDirectory"
  20.                 Type="STRING"
  21.                 Variable="CFRootDir">
  22.     <CFIF Server.OS.Name IS NOT "UNIX">
  23.         <CFSET CollectionPath="#CFRootDir#\Verity\Collections\">
  24.     <CFELSE>
  25.         <CFSET CollectionPath="#CFRootDir#/verity/collections/">
  26.     </CFIF>
  27.  
  28.     <CFCOLLECTION Action="CREATE"     Collection="CFexamples" 
  29.                                     Path="#CollectionPath#"
  30.                                     Language="english">
  31. </CFIF> 
  32.  
  33. <!--- OK, start paying attention again... :) --->
  34.  
  35.  
  36.  
  37. <!--- Check whether the index is properly built ---->
  38. <CFSEARCH 
  39.         NAME="CheckSearch" 
  40.         COLLECTION="CFexamples" 
  41.         CRITERIA = ""
  42.         MAXROWS = "1">
  43.  
  44.  
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  46.  
  47. <HTML>
  48. <HEAD>
  49.     <TITLE>Online Store - Search</TITLE>
  50. </HEAD>
  51.  
  52.  
  53. <BODY BGCOLOR="#FFCC00" LINK="Maroon" BACKGROUND="images/storebg.gif" LEFTMARGIN=5 TOPMARGIN=0>
  54.  
  55.  
  56. <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
  57. <TR>
  58.     <TD WIDTH=130 HEIGHT=15 NOWRAP ALIGN="RIGHT">
  59.         <CFINCLUDE TEMPLATE="_showcart.cfm">
  60.     </TD>
  61.     <TD WIDTH="70" NOWRAP> </TD>
  62.     <TD VALIGN="top" WIDTH=350>
  63.  
  64.     <BR><BR>
  65.  
  66.     <!--- If the index is empty, we need to index it; we're
  67.         assuming that the store has at least one item --->
  68.     <CFIF CheckSearch.RecordCount IS 0 >
  69.  
  70.         <H2><FONT FACE="Helvetica">Quick Search</FONT></H2>
  71.         
  72.         <P><FONT FACE="Helvetica" SIZE="-1">This store needs to be
  73.         indexed before it can be searched. Please be patient; indexing
  74.         may    take several moments, but only needs to be performed
  75.         once.</FONT></P>
  76.  
  77.         <FORM ACTION="verityindex.cfm" METHOD="GET">
  78.             <INPUT TYPE="SUBMIT" VALUE="Index">
  79.         </FORM>
  80.  
  81.     <!--- Otherwise just make an HTML form --->
  82.     <CFELSE>
  83.  
  84.         <H2><FONT FACE="Helvetica">Quick Search</FONT></H2>
  85.  
  86.         <FORM ACTION="results.cfm" METHOD="POST">
  87.             <INPUT TYPE="TEXT" NAME="Keyword"><BR>
  88.             <INPUT TYPE="SUBMIT" VALUE="Search">
  89.         </FORM>
  90.  
  91.     </CFIF>
  92.  
  93.     <CF_ShowDoc ID=1000>
  94.  
  95.     </TD>
  96. </TR>
  97. </TABLE>
  98.  
  99.  
  100. </BODY>
  101. </HTML>
  102.