if I use
<cfoutput>#somevariable#</cfoutput>
and somevariable
is not defined I get an error, how can I prevent the error from occourring?
is there a simple way of implementing a conditional that doesn't require a bunch of extra lines?
<cfparam name="somevariable" default="" />
If you're on cf 9 you can use a ternary operation, but cfparam is more 'best practicey'.
#isDefined("somevariable") ? somevariable : 'default string'#
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