You should not really use cfmodule, it's pretty much more for using custom tags. Although you can use it to include page templates as well, but the difference between cfmodule and cfinclude is for cfmodule, it does not share variables between caller page and sub pages, all the values you want to operate on must be passed in as attributes.
However, cfinlude DOES share variables between them. So in your case, I think you should really use cfinclude instead.
Quote:
Originally Posted by dmorand
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 "FooterTitle" are undefined.
Here is test.cfm:
-
<CFMODULE TEMPLATE="/templates/template.cfm"
-
Title="Test Title"
-
FooterTitle="Test Footer Title">
-
Here is template.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="loadSecVars()">
-
<!---<cfparam name="Title" default="Title App">
-
<cfparam name="FooterTitle" default="Footer App">--->
-
-
<!-- Removed Time from Field
-
<cfset #DateTime# = #DateFormat(CreateODBCDateTime(Now()),"mm-dd-yyyy")# & " " & #TimeFormat(CreateODBCDateTime(Now()),"HH:mm:ss")#>
-
-->
-
<cfset #DateTime# = #DateFormat(CreateODBCDateTime(Now()),"mm/dd/yyyy")#>
-
-
<!-- Container Begins -->
-
<div id="container">
-
<cfoutput><h3>#Title#</h3></cfoutput>
-
-
<!-- Footer Begins -->
-
<div id="footer">
-
<cfoutput><div 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>
-