How do you invoke custom tags? Do you use the
CF_MYTAG approach, or do you use
CFIMPORT? I started out using the CF_ technique, but now I find I prefer to use
CFIMPORT for the following reasons:
- I like the flexibility it gives me in terms of where I can put my custom tags (without having to create mappings).
- I like the ability to create “packages” or groups of related tags, which allows me to reuse tag names.
The Jimg project from DRK 4 comes with a set of custom tags for image manipulation: border, crop, draw, fill, height, load, pattern, rotate, save, scale, scaleToAtLeast, sequence, size, text, tint and width. I certainly wouldn’t want to copy all those tags in my CustomTag directory and take the chance of overwriting existing custom tags. Rather, I copy create a directory called “jimg” in my /cf_tags directory, and import them like this:
<cfimport taglib="/cf_tags/jimg" prefix="img"/>
Then, I can use the tags like this:
<img:sequence> <img:load .../> <img:scale .../> <img:save .../> </img:sequence>
What’s your preference, and why?