Search code examples
coldfusioninclude

Is there a ColdFusion equivalent to PHP for include_once?


I've been adding this to my pages:

pagewithinclude.cfm

<cfinclude template = "_pagename.cfm">

_pagename.cfm

<cfif Not IsDefined("variables.included_pagename")>
<cfparam name = "variables.included_pagename" default = "1">

rest of page

</cfif>

Is there a better way in CF? Something similar to PHP's include_once?


Solution

  • Nope, what you've done is probably the best way to do it. Although I'd use a Request variable instead.