A good way to learn about custom tags is to download a few and learn by example. Custom tags are no different from regular CFML. The main trick is learning how to pass variables back and forth from custom tags. I'll give a really simple example for you.
The calling program:
<cf_MakeName FirstName="John" LastName="Doe">
<cfoutput>
#FullName#
</cfoutput>
The custom tag (MakeName.cfm):
<cfset Caller.FullName = Attributes.FirstName & " " & Attributes.LastName>
As you can see, you can specify any variables you want when you call the tag and then reference them inside the tag. When you reference them from inside the tag they need the prefix of Attributes. To pass a variable back, assign the variable using the prefix of Caller. The custom tag can do anything you want it to, including screen output or calling of another custom tags. It can even call itself. Just make sure you copy the tag onto the server into the cfusion/Custom Tags directory.
Good luck! Just remember that custom tags are really nothing more than an intimidating name and after your first one you'll go "Oh, I get it!" |-0 Andrew
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.