1 person found this helpful
The normal ColdFusion solution to this problem is to use ColdFusion mappings. In previous versions of CF these could only be set up in the administrator as of CF8 one can not set these up within Appliction.cfc files. This helps with web hosting services where access to the administrator is not handy.
On singe site servers, CF can create a defaut mapping named "/". But this does not work well for multiple web site servers. For these you will need to create a more uniqe name for the mapping. But once you have a mapping set up for the web root of you site, either the basic "/" or something unique like "mySiteRoot", you can use these in your <cfinclude ...> tags.
<cfinclude template="/pageFooter.cfml"> <!--- using the basic "/" mapping --->
<cfinclude tempalte="mySiteRoot/pageFooter.cfm" <!--- using the unique "mySiteRoot" mapping --->
Thank you very much. Currently I am using a third-party server, and uploading my pages to thi sserver a few hundred miles South of my computer.... However, I would need to insure that the version of Cold Fusion being used by my hosting company is MX7 or 8, right? Will the help you gave me work on earlier versions than MX7, if this server I use (and pay "rent" to) has such an earlier version?
Using mappings with <cfinclude....> has been part of ColdFusion since at least version 4.5 when I started.
The ability to define these mappings yourself within an Application.cfc file was new to ColdFusion 8.
For older versions you would have to work with your hosting provider to enter the mappings in the ColdFusion Administrator control panal. Most service provider worthy of the name will have an ability to accomidate this type of request.
Please allow me some elbow room to sketch a mental picture; I've never used mappings before.
Is this correct?
ferns.cfm located in Root / Plantlife / wilderness
This is pretty raw, but having never used mappings before, I feel like a grade schooler. My punctuation may be off.
1 person found this helpful
I'm not sure if that is correct or not, you did not describe a mapping.
A mapping looks like this:
mappingName = system path.
/ = c://inetpub/wwwroot
/mySite = /export/home/users/webuser/htdocs
/cfcs = d://websites/common/components
These can be defined in the ColdFusion Administrator control pannel under Server Settings: Mappings OR as of ColdFusion 8 inside an Application.cfc file.
You would then use these in <cfinclude...> tags as the base of a path.
This would find c://intpub/wwwroot/aFile.cfm.
<cfinclude template = "/mySite/aDirectory/aFile.cfm">
This would find /export/home/users/webuser/htdocs/aDirectory/aFile.cfm.
<cfinclude template = "/cfcs/models/aComponent.cfc">
This would find d://websites/common/components/cfcs/models/aComponent.cfc.
<cfinclude template = "/wilderness/ferns.cfm">
This would find /root/plantlife/wilderness/ferns.cfm.