Skip to main content
Participant
April 23, 2009
Question

How do I use cfinclude

  • April 23, 2009
  • 1 reply
  • 524 views

I have a directory like this:

-root

  -includes

     -javascript

        -load_states.cfm

  -explorer

     -tools

        -reg_update

            -questions_render.cfm

Now i am currently working in questions_render.cfm file, and i want to write a <cfinclude> tag within this file to reference load_states.cfm.

How chould i write the relative path for load_states.cfm?

really thanks!

    This topic has been closed for replies.

    1 reply

    Inspiring
    April 23, 2009

    I find absolute paths easier to work with.  / puts you at the web root.  Then you just follow the path to your file.

    I find it odd that you would have a .cfm file in a directory called javascript.

    Participant
    April 23, 2009

    Thanks, i've resolved this problem, it looks like this:

    <cfinclude template="/includes/javascript/load_states.cfm">

    Yes, its not a javscript file but act exactly as a js file. The functionalities are same if you write a js file implements the same logic.

    Inspiring
    April 24, 2009

    Don't forget that you can set up virtual directory mappings at the CF Administrator level.

    i.e. set up a mapping for /js_includes/ that points to ROOT/includes/javascript

    Which helps when you are dealing with servers that host multiple CF sites.  May not be an issue for you.