coldfusion - Any way to get multiple CFIFs displaying inside CFSET? -


at moment have code working great -

<cfif (dailycount mod 2) eq 0> <cfset via = '<td style="background-color: dbefb6;">#src#<br><font   color="blue">#get_info.csuseragent#</font></td>'> <cfelse> <cfset via = '<td>#src#<br><font color="blue">#get_info.csuseragent#</font></td>'> </cfif> 

in #get_info.csuseragent# field, @ moment displaying whole ua string eg - mozilla/5.0 (windows nt 6.1; wow64; rv:23.0) gecko/20130406 firefox/23.0

i want put code below #get_info.csuseragent# tag displays broswer/device. works out of setup cannot work out how display in cell. can shed light on how these cfif statements appear within cfset?

<cfif '#get_info.csuseragent#' contains "blackberry">blackberry</cfif>  <cfif '#get_info.csuseragent#' contains "iphone">iphone</cfif> <cfif '#get_info.csuseragent#' contains "ipad">ipad</cfif>  <cfif '#get_info.csuseragent#' contains "android">android</cfif>   <cfif '#get_info.csuseragent#' contains "msie">ie</cfif> <cfif '#get_info.csuseragent#' contains "firefox">firefox</cfif> <cfif '#get_info.csuseragent#' contains "chrome">chrome</cfif> <cfif '#get_info.csuseragent#' contains "opera">opera</cfif> <cfif '#get_info.csuseragent#' contains "safari/534.53.10">safari</cfif> <cfif '#get_info.csuseragent#' contains "safari/534.57.2">safari</cfif> <cfif '#get_info.csuseragent#' contains "safari/533.21.1">safari</cfif> <cfif '#get_info.csuseragent#' contains "safari/533.19.4">safari</cfif> <cfif '#get_info.csuseragent#' contains "safari/533.18.5">safari</cfif> <cfif '#get_info.csuseragent#' contains "safari/534.50">safari</cfif> 

you can't embed tags within each other, invalid syntax:

<cfset myvar = <cfif something>"fred"<cfelse>"barney"</cfif>> 

what work in situation first set variable:

<cfif get_info.csuseragent contains "blackberry">     <cfset agent = "blackberry"> <cfelseif get_info.csuseragent contains "iphone">     <cfset agent = "iphone"> etc <cfelse>     <cfset agent = "unknown"> </cfif> 

and use it:

<cfset via = '<td style="background-color: dbefb6;">#src# <br><font color="blue">#agent#</font></td>'> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -