Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

Simplest of components won't run.

$
0
0

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:

cf components 2.png

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.


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>