Oh my word. Years ago I did a project in ColdFusion spaghetti tags, and am now back on it and wanting to improve it. Learning about Components, so I can stash the mostly reused code properly. I'm following a simple how-to on components from Components | Learn CF in a Week. And the darn thing will not work.
I keep getting the error:
But... syntax looks fine to me, and it's a direct cut and paste from the tutorial, anyway.
Here is Greeting.cfc:
<cfcomponent>
<cfscript>
component {
variables.baseGreeting = "Hello, ";
public string function getFullName (String firstName, String lastName) {
var fullName = arguments.firstName & " " & arguments.lastName;
return fullName;
}
public string function getGreeting (String firstName, String lastName) {
var fullName = getFullName(argumentCollection=arguments);
var greeting = variables.baseGreeting & fullName;
return greeting;
}
}
</cfscript>
</cfcomponent>
And here is the simple call page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<cfset Greeting = CreateObject("Component", "\CustomTags\Greeting.cfc") />
<cfset myGreeting = Greeting.getGreeting(firstName="Emily", lastName="Christiansen") />
<cfoutput>
#myGreeting#
</cfoutput>
</body>
</html>
What the everlovin' is going on here!?
Thanks in advance for the clue. Obviously, I have a long road ahead of me.