btintermedia
asked on
finding and implementing path in cf for cfcomponent
I am having difficulty implementing some code that is supposed to find/create the path to a component for my application.
- The cfcomponent is in the root directory.
- the file that is calling it is in a directory called 'modules'
the code that is calling it is:
<!--- begin example code --->
<cfset paginationPath = reReplace(replace(getDirec toryFromPa th(cgi.scr ipt_name), "/", ".", "ALL"), "(^\.|\.modules\.?$)", "", "ALL") />
<cfset pagination = createObject("component", "#paginationPath#.Paginati on").init( ) />
<!--- end example code --->
it generates the following error:
<!--- begin error example --->
The name .Pagination is not a valid component name.
Component names cannot start or end with dots.
The error occurred in E:\CustomerData\webspaces\ webspace_0 0104265\ww wroot\modu les\E_WebU sers.cfm: line 132
130 :
131 : <cfoutput>
132 : <cfset pagination = createObject("component", "#paginationPath#.Paginati on").init( ) />
133 : </cfoutput>
134 :
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser ColdFusion
Remote Address 216.151.164.71
Referrer
Date/Time 19-Jan-13 04:51 PM
Stack Trace
at cfE_WebUsers2ecfm103366215 6._factor7 (E:\Custom erData\web spaces\web space_0010 4265\wwwro ot\modules \E_WebUser s.cfm:132) at cfE_WebUsers2ecfm103366215 6.runPage( E:\Custome rData\webs paces\webs pace_00104 265\wwwroo t\modules\ E_WebUsers .cfm:1)
coldfusion.runtime.Templat eProxyFact ory$Invali dComponent NameExcept ion: The name .Pagination is not a valid component name.
at coldfusion.runtime.Templat eProxyFact ory.resolv eName(Temp lateProxyF actory.jav a:610)
at coldfusion.runtime.CFPage. createObje ct(CFPage. java:5704)
at coldfusion.runtime.CFPage. CreateObje ct(CFPage. java:5673)
at coldfusion.runtime.CFPage. CreateObje ct(CFPage. java:5638)
at cfE_WebUsers2ecfm103366215 6._factor7 (E:\Custom erData\web spaces\web space_0010 4265\wwwro ot\modules \E_WebUser s.cfm:132)
at cfE_WebUsers2ecfm103366215 6.runPage( E:\Custome rData\webs paces\webs pace_00104 265\wwwroo t\modules\ E_WebUsers .cfm:1)
at coldfusion.runtime.CfJspPa ge.invoke( CfJspPage. java:152)
at coldfusion.tagext.lang.Inc ludeTag.do StartTag(I ncludeTag. java:349)
at coldfusion.filter.Cfinclud eFilter.in voke(Cfinc ludeFilter .java:65)
at coldfusion.filter.Applicat ionFilter. invoke(App licationFi lter.java: 225)
at coldfusion.filter.RequestM onitorFilt er.invoke( RequestMon itorFilter .java:51)
at coldfusion.filter.PathFilt er.invoke( PathFilter .java:86)
at coldfusion.filter.Exceptio nFilter.in voke(Excep tionFilter .java:69)
at coldfusion.filter.BrowserD ebugFilter .invoke(Br owserDebug Filter.jav a:52)
at coldfusion.filter.ClientSc opePersist enceFilter .invoke(Cl ientScopeP ersistence Filter.jav a:28)
at coldfusion.filter.BrowserF ilter.invo ke(Browser Filter.jav a:38)
at coldfusion.filter.GlobalsF ilter.invo ke(Globals Filter.jav a:38)
at coldfusion.filter.Datasour ceFilter.i nvoke(Data sourceFilt er.java:22 )
at coldfusion.filter.RequestT hrottleFil ter.invoke (RequestTh rottleFilt er.java:11 5)
at coldfusion.CfmServlet.serv ice(CfmSer vlet.java: 107)
at coldfusion.bootstrap.Boots trapServle t.service( BootstrapS ervlet.jav a:78)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:257)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:541)
at jrun.servlet.jrpp.JRunProx yService.i nvokeRunna ble(JRunPr oxyService .java:204)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:426 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
<!--- end error example>
This code worked fine, in a previous example. I only changed the directory (as it was given in the example, by the developer) from 'examples' to 'modules' - but apparently, I have missed something else?
thanks for you help
- The cfcomponent is in the root directory.
- the file that is calling it is in a directory called 'modules'
the code that is calling it is:
<!--- begin example code --->
<cfset paginationPath = reReplace(replace(getDirec
<cfset pagination = createObject("component", "#paginationPath#.Paginati
<!--- end example code --->
it generates the following error:
<!--- begin error example --->
The name .Pagination is not a valid component name.
Component names cannot start or end with dots.
The error occurred in E:\CustomerData\webspaces\
130 :
131 : <cfoutput>
132 : <cfset pagination = createObject("component", "#paginationPath#.Paginati
133 : </cfoutput>
134 :
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser ColdFusion
Remote Address 216.151.164.71
Referrer
Date/Time 19-Jan-13 04:51 PM
Stack Trace
at cfE_WebUsers2ecfm103366215
coldfusion.runtime.Templat
at coldfusion.runtime.Templat
at coldfusion.runtime.CFPage.
at coldfusion.runtime.CFPage.
at coldfusion.runtime.CFPage.
at cfE_WebUsers2ecfm103366215
at cfE_WebUsers2ecfm103366215
at coldfusion.runtime.CfJspPa
at coldfusion.tagext.lang.Inc
at coldfusion.filter.Cfinclud
at coldfusion.filter.Applicat
at coldfusion.filter.RequestM
at coldfusion.filter.PathFilt
at coldfusion.filter.Exceptio
at coldfusion.filter.BrowserD
at coldfusion.filter.ClientSc
at coldfusion.filter.BrowserF
at coldfusion.filter.GlobalsF
at coldfusion.filter.Datasour
at coldfusion.filter.RequestT
at coldfusion.CfmServlet.serv
at coldfusion.bootstrap.Boots
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.jrpp.JRunProx
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
<!--- end error example>
This code worked fine, in a previous example. I only changed the directory (as it was given in the example, by the developer) from 'examples' to 'modules' - but apparently, I have missed something else?
thanks for you help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
should beOpen in new window
On a side note you could also do
<cfset paginationPath = expandPath('./')>