[Logo] smithproject.org
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
Problem with cfinclude: Absolute path?  XML
Forum Index -> Smith Development
Author Message
greymeister



Joined: 13/12/2007 18:35:06
Messages: 2
Offline

1 <cfinclude template="GlobalNav.cfm">

This bombs out with the following message:

Error message: Invalid file requested: /GlobalNav.cfm.
Error type: missinginclude
File: D:\JBoss\server\default\.\tmp\deploy\tmp16644lifebenefitsplus-exp.war\index.cfm
Row: 1
Column: 4


The file exists in the same directory as the one that calls it. I even tried using "./" but that still appended the first slash in front of it. Any ideas? Should I submit a SF bug or is this as designed?
greymeister



Joined: 13/12/2007 18:35:06
Messages: 2
Offline

I am sorry for the confusion, I had misspelled the file name

However, it did bring to my attention that Application.cfm would not compile for me. Here is my code:

Code:
 <cfcomponent output="false">
 
 	<cffunction name="onRequestStart" output="true" returntype="boolean">
 	
 		<!---<cfparam name="COOKIE.VisitStart" type="date" default="#now()#"> --->
 		
 		<cfinclude template="GlobalNav.cfm">
 		
 		<cfreturn true>
 
 	</cffunction>
 	
 	<cffunction name="onRequestEnd" returntype="void" output="true">
 	
 		<cfinclude template="SiteFooter.cfm">
 	
 	</cffunction>
 	
 </cfcomponent>
 



I saved the stack trace to an html file: Error.htm
maxime



Joined: 03/02/2008 17:47:51
Messages: 6
Location: Belgium
Offline

I confirm.

The CFINCLUDE tag don't take the script's currentpath when used in a CFCOMPONENT

Max
orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

Thanks for the post!
We'll check this out.
orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

I have tried the following, and it worked for me.
Could you please provide a test-case which makes this bug show up?


I have unpacked "smith-bin-windows-1.3b6.zip" to my D: drive and created the following files:

D:\smith-bin-windows-1.3b6\wwwroot\test\mycfc.cfc
Code:
 <cfcomponent output="false">
     <cffunction name="include" output="true" returntype="boolean">
         <cfinclude template="demo.cfm">
         <cfreturn true>
     </cffunction>
 </cfcomponent>


D:\smith-bin-windows-1.3b6\wwwroot\test\demo.cfm
Code:
 <html>
 This is demo page...


D:\smith-bin-windows-1.3b6\wwwroot\test\test.cfm
Code:
 <cfinvoke component="mycfc" method="include" returnVariable="status"/>
 <hr/> <cfdump var="#status#"/>


Then I started jetty and opened http://localhost:8081/test/test.cfm in my browser, and it worked well.

orcus

maxime



Joined: 03/02/2008 17:47:51
Messages: 6
Location: Belgium
Offline

I don't tested yet but the problem was when the .cfc is in a another folder than the invoke script

try this :

root/com/mycfc.cfc
Code:
  <cfcomponent output="false">
      <cffunction name="include" output="true" returntype="boolean">
          <cfinclude template="demo.cfm">
          <cfreturn true>
      </cffunction>
  </cfcomponent>
 



root/com/demo.cfm
Code:
  <html>
  This is demo page..
 


root/test.cfm
Code:
  <cfinvoke component="com.mycfc" method="include" returnVariable="status"/>
  <hr/> <cfdump var="#status#"/>
 


Normaly this code willl crash because he try to get demo.cfm from the root folder and not from the current folder of mycfc.cfc (root/com)

Say me if you need more. I'll redo the test when I can.

Yours,
Max
 
Forum Index -> Smith Development
Go to:   
Powered by JForum 2.1.6 © JForum Team