I'm trying to figure out how to use coldfusion templates. I thought I could setup a template and define all the variables I need and the template page would inherit the values from the declaration. Obviously that isn't the case because I'm getting errors on my page that "Title" and "FooterTitl e" are undefined.
Here is test.cfm:
[code=cfm]
<CFMODULE TEMPLATE="/templates/template.cfm"
Title="Test Title"
FooterTitle="Te st Footer Title">
[/code]
Here is template.cfm:
[code=cfm]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<head>
<title>System Access Request</title>
<link rel="stylesheet " type="text/css" href="css/style.css" />
<script type="text/javascript" src="../js/jstoolkit.js"></script>
</head>
<body onload="loadSec Vars()">
<!---<cfparam name="Title" default="Title App">
<cfparam name="FooterTit le" default="Footer App">--->
<!-- Removed Time from Field
<cfset #DateTime# = #DateFormat(Cre ateODBCDateTime (Now()),"mm-dd-yyyy")# & " " & #TimeFormat(Cre ateODBCDateTime (Now()),"HH:mm: ss")#>
-->
<cfset #DateTime# = #DateFormat(Cre ateODBCDateTime (Now()),"mm/dd/yyyy")#>
<!-- Container Begins -->
<div id="container" >
<cfoutput><h3># Title#</h3></cfoutput>
<!-- Footer Begins -->
<div id="footer">
<cfoutput><di v id="appTitle">< p><a href="./mainMenu.cfm"># FooterTitle#</a></p></div></cfoutput>
<div id="copyright"> <p>Copyright © 2007 - HealthAlliance Hospital</p></div>
<!-- Footer Ends -->
</div>
<!-- Container Ends -->
</div>
</body>
</html>
[/code]
Here is test.cfm:
[code=cfm]
<CFMODULE TEMPLATE="/templates/template.cfm"
Title="Test Title"
FooterTitle="Te st Footer Title">
[/code]
Here is template.cfm:
[code=cfm]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<head>
<title>System Access Request</title>
<link rel="stylesheet " type="text/css" href="css/style.css" />
<script type="text/javascript" src="../js/jstoolkit.js"></script>
</head>
<body onload="loadSec Vars()">
<!---<cfparam name="Title" default="Title App">
<cfparam name="FooterTit le" default="Footer App">--->
<!-- Removed Time from Field
<cfset #DateTime# = #DateFormat(Cre ateODBCDateTime (Now()),"mm-dd-yyyy")# & " " & #TimeFormat(Cre ateODBCDateTime (Now()),"HH:mm: ss")#>
-->
<cfset #DateTime# = #DateFormat(Cre ateODBCDateTime (Now()),"mm/dd/yyyy")#>
<!-- Container Begins -->
<div id="container" >
<cfoutput><h3># Title#</h3></cfoutput>
<!-- Footer Begins -->
<div id="footer">
<cfoutput><di v id="appTitle">< p><a href="./mainMenu.cfm"># FooterTitle#</a></p></div></cfoutput>
<div id="copyright"> <p>Copyright © 2007 - HealthAlliance Hospital</p></div>
<!-- Footer Ends -->
</div>
<!-- Container Ends -->
</div>
</body>
</html>
[/code]
Comment