labs.insert-title.com

Randomize YPN and Adsense

This is really very simple but I have been asked a number of times how I do this on some of my sites.

The Code


Public Shared Function placeAds(channel as integer,width as integer,height as integer,linkColor as string)	
Dim r as New Random
Dim x as integer
Dim adSTR as String	
x = r.Next(0, 100)
if x > 50
  adSTR = ("" & vbcrlf)
  adSTR  &= ("" & vbcrlf)

else		
  adSTR = ("" & vbcrlf)
  adSTR &= ("" & vbcrlf)
end if
	Return adSTR
End Function

Useage



placeAds(channelID,width,height,linkcolor)







Discussion

Will

Very interesting tutorial Joe. I have an off-topic question in regards to your content management system. My spider sense is tingling and telling me that you develop primarlily in VB.NET. I was curious as to what engine (if any) you are using for your site. The naming convention of your URL`s lead me to believe that if you are using a content management system (i.e. blog engine) that you have implemented URL rewriting. If you have successfully implemented URL rewriting on this site (or any other for that matter) I, along with many others I am sure, would definitely be interested in reading a cleverly-crafted how-to on the subject. All the articles that I have read on rewriting deal with C# and codebehind models. me (at) willasrari (dot) com

Joe Maddalone

All homegrown and handcoded... VB.NET... some sample code coming right up... you are going to hate how easy this is.

New comments are currently disabled, you can find me @joemaddalone Comments temporarily disabled for now, you can find me @joemaddalone