> If I remember correctly, doesn't cfmodule create a whole new memory
> block for every call, where as the cfinclude will only use the existing
> memory space and be part of the normal page cache?
Yes. In fact, that's at least part of the point. cfmodule -- and custom tags
in general -- provide encapsulation. I would only use cfinclude only if you
really want the included tag to be able to step all over your variables and
vise-versa.
> Even if this isn't true for CFMX any more, personally, I'd probably lean
> towards the cfinclude method, because
> a) thats what I'm used to,
> b) I find it visually easier to read
My preference is to use custom tags. I keep all the tags having to do with
the look and feel of a site in a directory called /tagLibs/layout. I then
use the cfimport tag to import them with the prefix "layout". It ends up
looking something like this:
<layout:page
htmlTitle="MySite.com - Home Page"
pageTitle="Welcome">
<layout:navigation section="Home">
</layout:navigation>
</layout:page>
Personally, I find that much easier to read. More importantly (almost as
important as encapsulation), it also affords me the ability to pass in
parameters via the tag attributes. The tags have corresponding cfparam tags
which check to ensure that parameters have been passed and supply defaults
if necessary.
> c) I feel like can tinker with the header and footer dynamically
> with a cfinclude than a cfmodule.
I assume by using the phrase "I feel like" you mean that there isn't a
practical difference? I would agree that the use of includes establishes
less of a contract between the caller and the tag/template. However, I think
that's a very bad thing. You, on the other hand, seem to prefer a less
formal interface between your cfm templates.
> and d) Easier to get to the header and footers if I need to change
> them or simply replace them.
I'm not sure I understand this. Why would you have to put your cfm template
anywhere different if you're using the cfmodule tag as opposed to cfinclude?
As far as I know, the path attribute of both tags obey all the same rules.
cfimport, on the other hand, does not accept dynamic values in the taglib
attribute.
As I said, I store all my tags in directories beneath a /tagLibs/ directory
and import them as necessary. However, you could put your files all in the
root directory of your site and use the cfmodule tag or even the cf_tagName
sytax.
> What goes on inside the the cfmodule? Is the header and footer actually
> inside the cfmodule template or does it include the header and footer
> templates? If it includes them, then it'd be a bit of a pointless call
> to the cfmodule, if its in the cfmodule template, then refer to my point
> (d) above. ;)
You're ignoring several key points, all mentioned above. In brief, though,
tags afford you 1) a degree of encapsulation; 2) specify parameters in a
more formal way; 3) the ability to enforce whether or not the end tag has
been specified (thisTag.hasEndTag); and 4) the ability to control the naming
of your tags (cfimport prefix attribute) and, by extension, their color
coding and such in your editor of choice.
Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185796
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54