understanding ColdFusion FindNoCase -
i'm going through coldfusion code , encountered following information. didn't understand part of it. questions follows:
code:
<cfif findnocase( "xyz.seta", "#cgi.server_name#") gt 0 > <cfset publicpath = "abcxyz/new_abc/public"> <cfset sessionpath = "abcxyz/new_abc/session">
i understand findnocase used find first occurance of substring in string, specified start position.
function syntax: findnocase(substring, string [, start ])
1) so, in case, xyz.seta
substring searched starting " #cgi.server_name# " ? confused here?
2) question regarding publicpath , sessionpath defined:
when checked server (after logging using vnc viewer), folders visible me public , session. can find path before it? please clarify or let me know if need study more before asking such question.
thanks
you correct first assumption. findnocase
return index of start of sub-string. think cf indexes 1 based (not 0 based). if string "xyz.seta"
exists in variable #cgi.servername#
, value returned greater 0 , contents of cfif
block execute.
on variables publicpath
, sessionpath
. these variables page variables not defined other scope designation (e.g. session or application). exist when page processing. if in application.cfm, execute every time application.cfm file called. values of variables being set paths relative the current directory. if want them absolute, add slash front of string literals (e.g. "/abcxyz/new_abc/public"
). make them absolute paths document directory of web server. web server path varies os os.
Comments
Post a Comment