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?
Nope, what you've done is probably the best way to do it. Although I'd use a Request variable instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With