1 Reply Latest reply on Feb 1, 2017 9:05 AM by haxtbh

    Absolute Links & Mappings

    weezerboy Level 1

      I am trying to setup a new site that is using absolute links.

      Every page I run gives me this type of error below (Could not find the included template /includes/..........) See below for full error

       

      How do I correct this?

      In the CFadmin > Server Settings > Mappings or

      IIS mappings

      or

      some code in application.cfc

       

      Could not find the included template /includes/head.cfm.

      Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.
      Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
        • 1. Re: Absolute Links & Mappings
          haxtbh Level 4

          Not sure what to answer here that hasn't already been said - the answer is in the text you posted:

           

          Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.

          Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.

           

          If you use CFINCLUDE then you will use a relative path (i.e. my_include.cfm)

           

          Otherwise use a mapping in coldfusion to point to the include and reference that mapping. So in Coldfusion admin you would set a the logical path to "/my_includes" and the directory path to "C:/cf/my_includes/"

           

          Then you can set the CFINCLUDE to be "/my_includes/my_include.cfm"