Google adsense in topic.asp - Posted (9039 Views)
Starting Member
dl4gbe
Posts: 36
36
Hello.
Here an example to add adsense in topic.asp



Add the folllowing function to topic.asp
please do not forget to set your own ID in
google_ad_client

Code:


sub Adsense(strColorBG)

Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """>" & vbnewline
Response.Write " <p><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b><span class=""spnMessageText"">Google Adsense</span></font>" & vbNewLine
response.write " <p><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>USA</small></font><br />" & vbNewLine & _
" <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>Mountain View</small></font></p></td>" & vbNewLine


Response.Write " </td>" & vbnewline & _
" <td bgcolor=""" & CColor & """ height=""100%"" width=""" & strTopicWidthRight & """"
if lcase(strTopicNoWrapRight) = "1" then Response.Write(" nowrap")
if (AdminAllowed = 1) and (maxpages > 1) then
Response.Write (" colspan=""3"" ")
else
Response.Write (" colspan=""2"" ")
end if
Response.Write "valign=""top"">" & vbnewline

Response.Write " <table width=""100%"" height=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td valign=""top"">" & vbNewLine


strColor = strColorBG

if (left(strColor,1) = "#") then
strColor = mid(strColor,2)
end if

%>

<script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "<%=strColor%>";
google_color_link = "0000FF";
google_color_bg = "<%=strColor%>";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<%


Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td valign=""bottom"" align=""right"" height=""20""><a href=""#top"">" & getCurrentIcon(strIconGoUp,strLangTopic00200,"align=""right""") & "</a></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine

end sub




at the beginning of the file declare one variable.
Code:

bolShowAdd = true


At the end of the big reply loop
bevor the next insert this.

Code:

if bolShowAdd = true then
adsense(CColor)
bolShowAdd = false
end if


Here is an example:

http://www.thai-wahn.com/topic.asp?TOPIC_ID=4755
Please note: colors only work with rgb values. In case you need a ColorName RGB converter I can post the code here.
Chris evil<
WWW.TIP-THAILAND.DE
The newspaper for the
German speaking Community in South East Asia (Offices in Phuket, Pattaya, Bangkok, Nong Khai, Vietiane)
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Starting Member
giaguaro
Posts: 2
2
up
Posted
Forum Moderator
AnonJr
Posts: 5768
5768
Originally posted by giaguaro
I include my topic.asp
It's a Serverhacker mod but i guess it's the same..
There's part of the problem - Its not the same. Its been too long since I last looked at Serverhacker's code to be able to say one way or the other how to help.
Add to that, you're looking to add something a little different than the original topic. There may be all sorts of odd little issues that you might not expect because of the differences in the ad code.

I would recommend that you first ask the Serverhacker community and see if they can help.

If they can't help, start a new topic instead of hijacking this one. Include the code (and/or a link to the reference) for the ad service you're trying to use and a link to a .txt version of your topic.asp
You Must enter a message