|
The File Functions allow your templates to be aware of thier own web and file paths. If an image does not exist, load a different one. There are 8 functions in this category. |
DirectoryExists() <!--- DirectoryExists(absolute_path) Use DirectoryExists() to determine whether a directory exists on the server. It is good to check whether the directory exists before using tags like CFFILE.---> <cfset GoodDirectory = getdirectoryfrompath(expandpath('*.*'))> <cfoutput> <cfif DirectoryExists(GoodDirectory)> <hr> <cfif DirectoryExists(BogusDirectory)> </cfoutput> |
ExpandPath() <!--- ExpandPath() returns the fully qualified path Using "*.*" as the relative_path paramater <cfoutput>
|
FileExists() <!--- Use FileExists() to determine It is good to check whether the directory exists <cfset FileName = GetFileFromPath(GetCurrentTemplatePath())> <cfoutput> <cfif FileExists(#FilePath#&#FileName#)> <hr> <cfif FileExists(#FilePath#&#BogusFileName#)> </cfoutput> |
GetBaseTemplatePath() <!--- GetBaseTemplatePath() returns the full path to the "top level"
template. <cfoutput> The Base Template Path of this file is:<br> </cfoutput> <!---Remove this comment to see how GetCurrentTemplatePath() differs <cfinclude template="GetCurrentTemplatePath.cfm"> ---> |
GetCurrentTemplatePath() <!--- GetCurrentTemplatePath() retains it's path info even if it <cfoutput> The Current Template Path of this file is:<br> </cfoutput> |
GetDirectoryFromPath() <!--- GetDirectoryFromPath() Supplies the "Path" <cfset FullyQualifiedPath = GetBaseTemplatePath()> <cfoutput> The Path to this file is:<br> </cfoutput> |
GetFileFromPath() <!--- GetFileFromPath() Supplies the "File" <cfset FullyQualifiedPath = GetBaseTemplatePath()> <cfoutput> The Name of this file is:<br> </cfoutput> |
GetTemplatePath() <!--- GetTemplatePath() returns the full path to the template. <cfoutput> The Template Path of this file is:<br> </cfoutput> |