Author |
Topic |
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 15 September 2005 : 18:39:29
|
To add a Google searchbox into your forum's search page as part of the Google Adsense program...
Create a new asp file with the following code and name it - inc_google_search.asp
_______________________________________________________________________________
<%
Response.Write " <br><br> " & vbNewLine
Response.Write " <form method=""get"" action=""http://www.google.com/custom"" target=""_top""> " & vbNewLine & _
" <table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap=""nowrap"" valign=""top"" align=""left"" height=""32"">" & vbNewLine & _
" <a href=""http://www.google.com/""><img src=""http://www.google.com/logos/Logo_25wht.gif"" border=""0"" alt=""Google"" align=""middle""></img></a>" & vbNewLine & _
" <input type=""text"" name=""q"" size=""31"" maxlength=""255"" value=""""></input>" & vbNewLine & _
" <input type=""submit"" name=""sa"" value=""WebSearch""></input>" & vbNewLine & _
" <input type=""hidden"" name=""client"" value=""pub-YOUR_ID_HERE""></input>" & vbNewLine & _
" <input type=""hidden"" name=""forid"" value=""1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""ie"" value=""ISO-8859-1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""oe"" value=""ISO-8859-1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""cof"" value=""GALT:#339933;GL:1;DIV:#663333;VLC:FF6666;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:67;LW:193;L:http://www.YOURSITE.com/YOURLOGO.gif;S:http://www.YOURSITE.com;LP:1;FORID:1;""></input>" & vbNewLine & _
" <input type=""hidden"" name=""hl"" value=""en""></input>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </form>" & vbNewLine
%>
______________________________________________________________________________
Please Note: In Line 10 you need to add your ID Number In Line 14 of the above you will need to add the link to your website logo and also your website The color variables can also be altered to change the text and background colors if required
In your search.asp file find the following (about line 639)
____________________________________________________________________________
end if ____________________________________________________________________________
and after it add the following: ____________________________________________________________________________
%>
<!--#INCLUDE FILE="inc_google_search.asp"-->
<% ____________________________________________________________________________
It's relatively easy to do :)
Webbo< |
Edited by - Webbo on 15 September 2005 18:42:16 |
|
corinaw
Starting Member
USA
22 Posts |
Posted - 04 February 2006 : 02:23:00
|
Hello webbo, I tried this, and it does work, but the google search box on my site is black- (even though I specified a white background in the google code)
The major issue I have is that the code inserts right in between the two blue boxes in search.asp, right after the search for, and before the search in.
Is there a way to make this work was where the google search for is the first one up? Thanks very much for any assistance.
corina < |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 04 February 2006 : 16:20:29
|
It sounds like you've added the following code in the wrong place in your search.asp file
%> <!--#INCLUDE FILE="inc_google_search.asp"--> <%
Can you show us a link to your search page or a text version of your search.asp file?< |
|
|
corinaw
Starting Member
USA
22 Posts |
Posted - 04 February 2006 : 22:07:03
|
Hi Podge, Thanks for the reply. I've tried several times to reposition it, and I get an error, such as unexpected end statement, or something like that. Unfortunately I'm FAR away from being an asp pro, so it's not really clear to me where I can put the code ;)
I just loaded the current version of the forum so the code and settings are all (mostly) default- I was thinking the instructions webbo listed could have been for the prev version. As I mentioned the background was black, but I was able to change the settings and fix it.
I also noticed (w/ mod) I get a listing of all the forum categories right afer the search box (House Cleaning Tips Stain Removal Start a House Cleaning Business) It does not do that w/o mod, so I'm concerned maybe it breaks something else.
Looking at the html of the current page, I see this code below right under the google search box, so I'm pretty sure it's breaking something else too. <option value="1">House Cleaning Tips</option> <option value="2">Stain Removal</option> <option value="3">Start a House Cleaning Business</option>
If you can take a look and give me some advise on getting the google search first, above both the blue boxes I'd really appreciate it!
http://www.mrscleannw.com/forum/search.asp< |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 05 February 2006 : 05:13:09
|
Here's a link to my search page Click Here
Can you post a link to a txt version of your search.asp and I'll reposition your google code for you< |
|
|
corinaw
Starting Member
USA
22 Posts |
Posted - 05 February 2006 : 15:47:53
|
Hi Webbo.
<edit> sorry here is a copy of search.asp in text format </edit>
http://www.mrscleannw.com/forum/search.txt
Thanks very much!!< |
Edited by - corinaw on 05 February 2006 23:42:12 |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 06 February 2006 : 18:24:11
|
Here you are: search.ap
Rename your original search.asp file to something like search1.asp and upload the one in the zip file instead Any problems let me know
< |
|
|
corinaw
Starting Member
USA
22 Posts |
Posted - 07 February 2006 : 01:19:58
|
Thanks very much Webbo! I got it placed just fine.
Regards, corina< |
|
|
wildfiction
Junior Member
167 Posts |
Posted - 14 February 2006 : 00:59:35
|
Thanks Webbo - that's very useful.
I had a look at your forum and I see that it needs another mod. The reason that I say that is because I also need to add a mod but haven't got a chance to writing it yet.
Reason: I notice that AdSense ads for Snitz Skis appear on your forum. This is because when Google parses your page it picks up the text "snitz" on the page. Now if we wrapped the following code: <!--google_ad_section_start--> <!--google_ad_section_end--> around the subject and body text then Google will give the most emphasis to that text when deciding what types of ads to display. In other words - better targeted ads for your forum.
If I get a chance this weekend I'll look at doing the mod - otherwise if someone wants to suggest where I start that would also help.< |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 14 February 2006 : 17:01:24
|
Okay Wf, I'll look out for it< |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 14 February 2006 : 17:04:50
|
ps, I've just altered the code in my inc_footer.asp file to that written by member Corinaw and it certainly is a nice alteration
Corinaw's code:
'########### start google ads
if not(Instr(Request.ServerVariables("Path_Info"), "default.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "active.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "forum.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "topic.asp") > 0) then
GoogleAdOK=FALSE
else
GoogleAdOK=TRUE
end if
if GoogleAdOK=TRUE then
%>
<!--#INCLUDE FILE="inc_google_adunit.asp" -->
<%
end if
'########### end google ads
< |
|
|
natefun
Starting Member
8 Posts |
Posted - 09 March 2006 : 11:09:26
|
I have tried using the following code for my google adsese, but exactly where do I add it in my inc_footer.asp, I must be adding it in an incorrect spot because I get errors when some of my asp files load after I add the code.
quote: Originally posted by Webbo
ps, I've just altered the code in my inc_footer.asp file to that written by member Corinaw and it certainly is a nice alteration
Corinaw's code:
'########### start google ads
if not(Instr(Request.ServerVariables("Path_Info"), "default.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "active.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "forum.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "topic.asp") > 0) then
GoogleAdOK=FALSE
else
GoogleAdOK=TRUE
end if
if GoogleAdOK=TRUE then
%>
<!--#INCLUDE FILE="inc_google_adunit.asp" -->
<%
end if
'########### end google ads
< |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 15 March 2006 : 17:40:04
|
I've got the following code at Line 40 after the copyright statement and the %>
<%
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"<table width="""" align=""center"" border=""0"" bgcolor=""" & strForumCellColor & """ cellpadding=""0"" cellspacing=""1"">" & vbNewLine
if not(Instr(Request.ServerVariables("Path_Info"), "default.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "active.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "forum.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "classdetail.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "classifieds.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "classViewAds.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "classViewads.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "classDetail.asp") > 0) and _
not(Instr(Request.ServerVariables("Path_Info"), "topic.asp") > 0) then
GoogleAdOK=FALSE
else
GoogleAdOK=TRUE
end if
if GoogleAdOK=TRUE then
%><script type="text/javascript"><!--
google_ad_client = "pub-51916800000";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "A8DDA0";
google_color_bg = "EBFFED";
google_color_link = "0000CC";
google_color_url = "008000";
google_color_text = "6F6F6F";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Whether this will work on yours or not I don't know as my inc_footer has been changed a lot from the Snitz original< |
|
|
TonyB7
Junior Member
USA
267 Posts |
Posted - 25 April 2006 : 00:29:24
|
Just for future readers having trouble finding the 'end if' after which to put this...
Look for 'WriteFooter' in search.asp (unlike 'end if' there's only one). Put the include just before the line.< |
|
|
|
Topic |
|