ColdFusion cfinclude variable passing

By admin | September 10, 2009

I just ran into an issue when i needed to pass a variable into a template i had called using <cfinclude>.

Coldfusion will error if you try and pass a variable within the include tag Eg. <cfinclude template=”mypage.cfm?myvariable=1″>

To get around this all you need to do is pass in the variable before the include tag, appended with URL..

Eg.
<cfset URL.myvariable = 1>
<cfinclude template=”mypage.cfm”>

Now mypage.cfm will grab the URL.myvariable and go about business as usual.

  • Share/Save/Bookmark

Topics: Coldfusion |

One Response to “ColdFusion cfinclude variable passing”

  1. Kris Says:
    November 17th, 2010 at 5:04 am

    Wow. I will finally stop hitting head against desk.

Comments