macromedia.coldfusion.getting_started
[Top] [All Lists]

variables.searchphrasepq undefined

Subject: variables.searchphrasepq undefined
From: "Hydrowizard"
Date: Tue, 15 Jan 2008 15:05:52 +0000 UTC
Newsgroups: macromedia.coldfusion.getting_started

Hi all I`ve been working on this for a while now and it has been useful to 
understand lists and list functions. The following code gets whatever keywords 
there are on the right(listlast really) of the = delimiter. This works fine for 
google but no I tried to add a new condition as other search engines use ?p= or 
?q= to define string so a string like 
http://search.msn.com?p=keywords+keywords&int&=N it will get the first in the 
list after the ?p= not N if that makes sense. I thought I was getting there 
defining if the string has <cfset findq=find("[p=]|[q=]", qrysales.referer)> 
 Really I just need a hand please and a push in the right direction-not code 
just a nod as to what I need to do! Thanks    
 <table width="792">
 <tr>
 <td>
  <div align="center">
       <a href="searchengines.cfm?sortBy=visit">Date</a>
     </div>
 </td>
 <td> <div align="center">
       <a href="searchengines.cfm?sortBy=id">Visit No.</a>
     </div>
 </td>
 <td> <div align="center">
       <a href="searchengines.cfm?sortBy=id">Search Engine</a>
     </div></td>
 <td> <div align="center">
       <a href="searchengines.cfm?sortBy=referer">Keywords (click on record to 
see full query)</a>
     </div>
 </td>
 </tr>


 <!---  output the all the rows in the query qrysales --->
 <cfoutput query="qrysales" startrow="#nav.startrow#" maxrows="#nav.maxrows#"> 

 <cfset strStart = find("?", qrysales.Referer)> 

 <cfset referer_queryString = 
right(qrysales.Referer,len(qrysales.Referer)-strStart)>

 <cfset findq=find("[p=]|[q=]", qrysales.referer)>
 <cfset referer_findq = left(qrysales.Referer,len(qrysales.Referer)-findq)> 
 <cfif find("[p=]|[q=]", referer_findq)>
 <cfset searchPhrasepq = listfirst(referer_findq,"=")>  
 </cfif>

 <cfloop list="referer_querystring" delimiters="%" index="i" >

 <cfset variables.searchPhrase1 = listlast(referer_findq,"=")>  

 <!---then we get rid of all the searchphrase1 rubbish chars--->
 <cfset googlewords=#replacelist(variables.searchphrase1,"+,/,=,%,http:, 
3Fq3,'=es',terms,search,query,qkw,2B,&meta,3Fq,3D,2D,2522,26start,26svnum,600,46
947,SZIR,wl,[%20],26st",", , , , , , , , ")#>

 <tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('efefef'))#">
 <td>#qrysales.visit#</td>
 <td>#qrySales.id#</td>
 <td>  <cfif find("google.it", qrysales.referer)>
       Google Italy
 <cfelseif find("google", qrysales.referer)>
       Google
 <cfelseif find("msn", qrysales.referer) or find("live.com", qrysales.referer)>
       MSN Live
 <cfelseif find("yahoo", qrysales.referer)>
       Yahoo
 <cfelseif qrysales.referer does not contain "google" or qrysales.referer does 
not contain "yahoo"
  or qrysales.referer does not contain "msn">
       Other search engine
       </cfif></td>
 <td>
 <cfif len(googlewords) is 0>
 hey#qrysales.referer#
 <cfelseif len(googlewords) and find("N", "#googlewords#")>
 <cfset innitnow=find("N", "#googlewords#")>
 #variables.searchphrasepq# n found

 <cfelse>

 <a href="keywords.cfm?id=#qrysales.id#">#len(googlewords)# #googlewords#</a>

 </cfif>
 </tr>
 </cfloop> 
 </cfoutput>

 </table>



<Prev in Thread] Current Thread [Next in Thread>