Using CFIMPORT with Custom Tags - Exercise

Contact Us or call 1-877-932-8228
Using CFIMPORT with Custom Tags - Exercise

Using CFIMPORT with Custom Tags

Duration: 10 to 20 minutes.

In this exercise you will import and use a custom tag library.

  1. Create a new directory at the root of your C drive and name it "CustomTags".
  2. In the C:/CustomTags directory, create another directory called "Strings".
  3. Open CustomTags/Solutions/Text2Table.cfm and save it in the C:/CustomTags/Strings directory you just created.
  4. Open ColdFusion Administrator in your browser and add a mapping named "CustomTags" to "C:\CustomTags".
  5. Open CustomTags/Exercises/ProfitLoss.cfm and save it as CustomTags/Exercises/ProfitLoss2.cfm.
  6. Add the following line of code at the very top of the page:
    <cfimport prefix="String" taglib="/CustomTags/Strings">
  7. Modify the rest of the page so that it uses the custom tag from the Strings library.
  8. To test your solution, open CustomTags/Exercises/ProfitLoss2.cfm in your browser.


               <cfimport prefix="String" taglib="/CustomTags/Strings">
  <title>Profit Loss</title>
<h1>Profit Loss</h1>

<cfset FilePath = ExpandPath("ProfitLoss.txt")>
<cfif FileExists(FilePath)>
	<cffile action="read" file="#FilePath#" variable="myfile">
	<String:Text2Table HeaderRow="true">