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

  1. <!--- This template lists the employees, grouped by department, and lets
  2.     the user click on an employee to view details --->
  3.  
  4. <!--- Get employees (and their departments); and order by
  5.     department because that's what we're going to group by --->
  6. <CFQUERY DATASOURCE="CFexamples" NAME="GetEmployees">
  7. SELECT * FROM EmpEmployees, EmpDepartments
  8. WHERE EmpEmployees.DepartmentID = EmpDepartments.DepartmentID
  9. ORDER BY DepartmentName, EmpEmployees.DepartmentID, LastName, FirstName
  10. </CFQUERY>
  11.  
  12. <!--- These two lines set up the <HEAD></HEAD>, <BODY></BODY>,
  13.     and other page layout attributes that should be consistent though the site  --->
  14. <CFINCLUDE TEMPLATE="_header.cfm">
  15.  
  16. <TR>
  17.     <TD COLSPAN="3">
  18.  
  19.         <TABLE WIDTH="90%" BORDER="0" CELLSPACING="0" CELLPADDING="5" ALIGN="CENTER">
  20.         
  21.         <!--- Output the query data; the code between this <CFOUTPUT>
  22.             and the next <CFOUTPUT> is only outputted once per
  23.             DepartmentID, since it is grouped by DepartmentID --->
  24.         <CFOUTPUT QUERY="GetEmployees" GROUP="DepartmentID">
  25.             <TR>
  26.                 <TD COLSPAN="4" HEIGHT=30 VALIGN="bottom">
  27.                     <BR><BR><FONT FACE="Myriad Web, Verdana, Helvetica" SIZE="4"><B>#DepartmentName#</B></FONT>
  28.                 </TD>
  29.             </TR>
  30.  
  31.             <!--- Now we start outputting for every record
  32.                 (i.e. every employee) --->
  33.             <CFOUTPUT>
  34.                 <TR>
  35.                     <TD WIDTH=25 NOWRAP> </TD>
  36.                     <TD ALIGN="right" VALIGN="top">
  37.                         <FONT FACE="Arial, Geneva, Helvetica" SIZE="-1">
  38.                             <A HREF="Details.cfm?EmpID=#EmpID#">#LastName#, #FirstName#</A><BR>
  39.                         </FONT>
  40.                         <FONT FACE="Arial, Geneva, Helvetica" SIZE="-2">
  41.                             #Title#<BR>
  42.                         </FONT>
  43.                     </TD>
  44.                     <TD VALIGN="top" ALIGN="right"><FONT FACE="Arial, Geneva, Helvetica" SIZE="-1">#Phone#<BR></FONT></TD>
  45.                     <TD VALIGN="top" ALIGN="right"><FONT FACE="Arial, Geneva, Helvetica" SIZE="-1"><A HREF="mailto:#Email#">#Email#</A><BR></FONT></TD>
  46.                 </TR>
  47.             </CFOUTPUT>
  48.  
  49.         </CFOUTPUT>
  50.         
  51.         </TABLE>
  52.     </TD>
  53. </TR>
  54. <TR>
  55.     <TD HEIGHT="35" COLSPAN="3"> </TD>
  56. </TR>
  57. </TABLE>        
  58.  
  59. <!--- Close the document --->
  60. <CFINCLUDE TEMPLATE="_footer.cfm">