3 Replies Latest reply on Mar 25, 2010 8:50 AM by cfrookie

    trouble with cfinclude within CFBuilder

    cfrookie

      This seems like the silliest question but I cannot for the life of me get a cfinclude tag to work within my application in CFBuilder.  I always get the standard "cannot find" CF error displayed instead.

       

      I'm on OS X.  Document root is /Applications/ColdFusion9/wwwroot/site and my web root is /Applications/ColdFusion9/wwwroot

       

      It doesn't matter if I reference any of the following, my "includes" folder is not found.

       

      /Applications/ColdFusion9/wwwroot/site/includes

      /site/includes

      includes (relative)

       

      If I put a file in the includes folder and preview it it displays without a problem.  The file outputs the following information when I use cgi.CF_Template_Path:

       

      /Applications/ColdFusion9/wwwroot/site/includes/location-test.cfm

       

      I've tried deleting the server instance in CFB and adjusting document/web root settings to no avail.

       

      What am I missing (feeling pretty stupid )?  Seems like the CFINCLUDE tag just doesn't work on my local server.

       

      Thanks in advance,
      Scott

        • 1. Re: trouble with cfinclude within CFBuilder
          cfrookie Level 1

          After some more troubleshooting I've narrowed down my problem to something that works currently on a CF7 box.

           

          <cfinclude template="<cfoutput>#application.pathtoroot#</cfoutput>includes/body_header.cfm">

           

          If I remove the <cfoutput>#application.pathtoroot#</cfoutput> the file is included properly.

           

          #application.pathtoroot# allows me to develop on a server where the site can't start in the web root directory and in this case = "/site/".

           

          While the above code with <cfoutput> in the template attribute of the cfinclude throws an error, the following does not so I know it's not a path issue.

           

          <cfinclude template="/site/includes/body_header.cfm">

           

          The error message displays the proper path when saying it cannot locate the included file "Could not find the included template /site/includes/body_header.cfm."

           

          I also tried changing the scope from application. to mysettings. and the error still occurs.

           

          Looks like the problem was the cfinclude tag no longer needs <cfoutput> tags wrapped around the pathtoroot variable I had set.  I knew it had to be a stupid problem!

          • 2. Re: trouble with cfinclude within CFBuilder
            Adam Cameron. Level 5

            As far as I know one has never been able to embed one CF tag within another one.

             

            And certainly having <cfoutput> there is meaningless, because you're not OUTPUTTING that variable; you're just using it.

             

            --

            Adam

            • 3. Re: trouble with cfinclude within CFBuilder
              cfrookie Level 1

              Ahh, ok.  I guess a more correct statement would have been "no longer allowed/tolerated"