March 3, 2008

Always add the <cfimport> tag when using cfimport style syntax

Using cfimport is a great way to add custom tag functionality to your applications.

One thing you need to do of course is add a tag to every template where you want to use the cfimport syntax. However, a couple of times when I’ve been creating new templates I’ve forgotten this rule and not added and subsequently gotten confused when my results aren’t as expected.

I think the annoying thing is that ColdFusion does not throw an error in these situations, it just does nothing. So I can go to any template and add the following (without a on my template):

<tags:myNonExistentTag />

And the template runs without an error being thrown :(

So my reminder to myself before looking everywhere else is:

“Michael…for the love of Benji please check that you’ve added before doing any other debugging!”

Now my question (which I’m sure someone out there knows) is why does this not throw an error (missing template/include/tag etc)?

© Michael Sharman 2017