Cannot find CFML template for custom tag
Asked Answered
A

3

9

I am not a ColdFusion coder. Doing a favor for a friend who ported his CF site from a Windows server to Unix on GoDaddy.

Site is displaying error:

Cannot find CFML template for custom tag jstk. ColdFusion attempted looking in the tree of installed custom tags but did not find a custom tag with this name.

The site as I found it has at document root /CustomTags with the jstk.cfm file and a set of files in cf_jstk

My Googling located this:

You must store custom tag pages in any one of the following: The same directory as the calling page; The cfusion\CustomTags directory; A subdirectory of the cfusion\CustomTags directory; A directory that you specify in the ColdFusion Administrator

So I have:

  • Tried creating placing /CustomTags in /cfusion/CustomTags
  • Tried copying /cfusion/CustomTags to above document root
  • Tried copying jstk.cfm and subfolders into same directory as calling file(index.cfm)

Update: Per GoDaddy support I have also tried adding the following to no effect: <cfmodule template="CustomTags/jstk.cfm">

Can any one give me some tips on this or should I just tell my guy to look for a CF coder?

Thanks!

Allegra answered 14/5, 2010 at 15:37 Comment(0)
A
3

I don't know how GoDaddy is setup, so as a quick test, please do the following:

Create file test.cfm in the webroot with contents:

<cf_testtag/>
<cfoutput>test</cfoutput><cfabort/>

Create file testtag.cfm in the webroot with contents:

<cfdump var=#ThisTag# />

Then in a browser visit the test.cfm page.

You should get two debug dumps, followed by the 'test'; this will confirm that custom tags in general are working.

If that works move the testtag.cfm to the CustomTags directory, and see if you get the same behaviour or an error.

If this produces an error, for CF8 and above, you can add <cfset This.CustomTagPaths = "/CustomTags" /> inside the Application.cfc file (assuming there is a App cfc and not an Application.cfm) to ensure that directory is checked for tags.

It is possible to convert Application.cfm to Application.cfc - how easy this is depends on how complex the code is in there - might be something you could figure out, or might need an experienced CF dev, it depends.

Depending on the outcome of this, we can attempt to debug why the jstk tag isn't working (unless one of the above solves it).

Authorize answered 14/5, 2010 at 16:7 Comment(14)
Thanks Peter! The initial placement in webroot worked. When testag.cfm was moved to the CustomTags directory I then got error "Cannot find CFML template for custom tag testtag. " BTW per GoDaddy "support" I have also tried adding the following to no effect: <cfmodule template="CustomTags/jstk.cfm">Allegra
Sorry, also adding <cfset This.CustomTagPaths = "/CustomTags" /> to existing application.cfm did not change outcome,Allegra
Yeah, the cfmodule is basically an alternate way of calling a custom tag, which doesn't require the file to be in a specific directory. If the path is correct it should have worked. Can you try that route with the simple test tag?Authorize
Yeah, in Adobe CF the CustomTagPaths only works in Application.cfc - Adobe didn't add the ability to Application.cfm since that's the older way, which is annoying. Railo (another CFML engine) has added the ability to use CustomTagsPaths via the cfapplication tag (i.e. inside Application.cfm), but unfortunately that doesn't help here.Authorize
Tried adding to test.cfm <cfmodule template="CustomTags/testtag.cfm"> This resulted in the "struct" table being printed followed by "Cannot find CFML template for custom tag testtag. "Allegra
Hmmm, did you leave the <cf_testtag/> bit after it? If so, that would explain the error, (if not I'm confused). If the cfmodule works, you'll need to replace all <cf_jstk ...> calls with equivalent <cfmodule template="CustomTags/jstk" ...> calls I'm afraid. (Or trying converting the App.cfc to App.cfm - may or not be less work depending on how often the tag is used/etc).Authorize
So my current test.cfm's whole contents are <cfmodule template="CustomTags/testtag.cfm"> <cf_testtag/> <cfoutput>test</cfoutput><cfabort/> is that what I should have?Allegra
If cfstk.cfm has <cfset cTagName = "CF_JSTK"> but the inc file uses lower case like so <cf_jstk include="menu"> is this a casing issue in CF under Unix?Allegra
SORRY! Re-read and removed <cf_testtag/> and now get the one struct table and no error for file containing <cfmodule template="CustomTags/testtag.cfm"> <cfoutput>test</cfoutput><cfabort/>Allegra
If you put a / on the end of the cfmodule you'll get the two struct dumps.Authorize
The <cf_jstk include="menu"> doesn't matter about case (afaik; I'm not 100% on that one) - but if the cTagName variable is used in a filename somewhere, that would be an issue (e.g. <cfmodule template="#cTagName#.cfm" /> or <cfinclude template="./#cTagName#/other_stuff.cfm"/> or similar)Authorize
Yep, adding the closing slash did produce the two dumps. I think I should tell my guy to get himself a CF coder.Allegra
Sounds like it's getting that way. There's probably some mailing lists on www.houseoffusion.com that should help in that respect.Authorize
Thanks very much for your help and time! If you find yourself coming to New Orleans I owe you several beers!Allegra
S
3

In an effort to check the simple things before worrying about complex things: Remember that filenames on *nix systems are case sensitive, but on windows are not.

For example, a windows server will pick up "application.cfm" but a linux server won't. It requires "Application.cfm".

Check to make sure all filenames/paths are the correct case.

Scanderbeg answered 14/5, 2010 at 16:30 Comment(1)
Thanks Ben, I have been watching that. So far have not found any case errors.Allegra
E
3

Normally, CFML check every custom tags in current directory first, if not found, second is in CFMX8/customtags/.

Erasmoerasmus answered 18/5, 2010 at 3:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.