At the moment I have this code which is 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 the #get_info.csuseragent# field, at the moment it is displaying the whole UA string eg - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0
I want to put the code below where the #get_info.csuseragent# tag is so it just displays the broswer/device. This works normally out of this setup but I cannot work out how to get it to display in that cell. Can anyone shed any light on how to get these CFIF statements to appear within this 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, so this is invalid syntax:
<cfset myVar = <cfif something>"fred"<cfelse>"barney"</cfif>>
What will work in your situation is to first set a 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 then use it:
<cfset via = '<td style="background-color: DBEFB6;">#src#
<br><font color="blue">#agent#</font></td>'>