tags:

views:

140

answers:

1

My cfimport works on the page, but I tried moving it to onRequestStart and it didn't work. Then I tried putting it in a cfinclude one folder down, and that didn't work. Does the cfimport have to be on the page itself?

+6  A: 

Yes, the tags can only be used on the page where cfimport is used; from the documentation:

The cfimport tag must be on the page that uses the imported tags. For example, if you use a cfimport tag on a page that you include with the cfinclude call, you cannot use the imported tags on the page that has the cfinclude tag. Similarly, if you have a cfimport tag on your Application.cfm page, the imported tags are available on the Application.cfm page only, not on the other pages in the application. ColdFusion does not throw an error in these situations, but the imported tags do not run.

Alistair Knock
Thank you for this answer. I feel a bit sheepish that the solution was in the manual, but honestly there's so much to read and I don't think I have a printed copy of the manual anyway that I can just sit down and highlight, etc. So much of my struggle has to do with just syntax. I wish I could get over this hurdle of just having to learn the syntax and get onto the bigger problems, like logic.
cf_PhillipSenn
The online documentation can be frustrating at times too, so I find when you know your problem is with a particular tag, a straightforward search for 'cfimport' brings back a handful of useful pages from the usual excellent blog sources. Once you get used to the quirks it becomes a very fast development tool though.
Alistair Knock
http://cfquickdocs.com/cf8/There's a good reference for tags/functions, if you need one. Much faster than the Adobe docs.
Jason