Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I use cfinclude

New Here ,
Apr 22, 2009 Apr 22, 2009

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!

491
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 22, 2009 Apr 22, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2009 Apr 22, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 24, 2009 Apr 24, 2009
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources