Copy link to clipboard
Copied
Hello, all,
Y'know.. in all the years that I've been coding in CFML, it never once occurred to me to ask the following question, but here it is..
If I have a page as such:
<!DOCTYPE html>
<html>
<head><title>Unknown Comic</title></head>
<cfinclude url="menu.cfm"/>
blah blah blah - foo bar
<cfinclude url="footer.cfm" />
</html>
Does the application.cfc trigger only once (for the document, itself)? Or does it trigger once for the document, then once for each include (total of three times for above example)?
V/r,
^_^
(Forgive the n00b question - it just never came to mind until now.)
URL attribute aside, the cfincludes pull the content "into" the existing .cfm page, so the appropriate Application.cfc methods would be called only once. This is still considered one request.
Copy link to clipboard
Copied
The cfinclude tag does not currently have a "url" attribute. It does not make another request to the server and thus does not involve application.cfc
Cheers
Eddie
Copy link to clipboard
Copied
URL attribute aside, the cfincludes pull the content "into" the existing .cfm page, so the appropriate Application.cfc methods would be called only once. This is still considered one request.
Copy link to clipboard
Copied
Thanks, @nic_tunney. I couldn't shake that feeling that it was being triggered for each include.
V/r,
^_^
Copy link to clipboard
Copied
You are implying that the cfinclude tag invokes Application.cfc which is not the case. For clarity, no matter how many cfincludes you use, the Application.cfc is not involved. It is the single request that an agent makes of the server that invokes Appliction.cfc.
Cheers
Eddie
Copy link to clipboard
Copied
I am not implying anything; I'm asking.
I didn't think that cfinclude was triggering application.cfc; I thought that the .cfm file loaded via cfinclude might be triggering application.cfc, because I understood that every .cfc and .cfm file triggered application.cfc.
But now I am of the understanding that only the .cfm file requested by the browser triggers the application.cfc.
V/r,
^_^
Copy link to clipboard
Copied
If you look at the text above my post, you will see this:
Eddie Lotter Mar 24, 2016 6:07 AM (in response to nic_tunney)
In other words, I was not saying that you were implying anything. I'm sorry if you felt misunderstood.
Cheers
Eddie
Copy link to clipboard
Copied
Sorry.. I tend to treat all replies as to the channel/thread, not individual users. I rarely look at the "in response to", mostly because it almost blends into the background, the letters are so thin.
But, reading nic_tunney's response, I don't think that nic was implying cfinclude was triggering the application.cfc. Just MHO. I understood it as "cfinclude brings content (from other files) into the existing page", which I guess could be construed as an indirect invoke considering that the content is pulled from another CFML source.
But, I digress (and boy is that painful - bah-dum-bum, tsssssss.)
^_^