Thread: Help with phpbb
View Single Post
Old 08-19-2004, 12:39 AM   #15 (permalink)
littleFella
Inactive
 
littleFella's Avatar
 
Join Date: 06-20-04
Location: Ontario
Posts: 3,359
iTrader: 0 / 0%
Latest Blog:
None

littleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to beholdlittleFella is a splendid one to behold
The way I see it the hardest part is deciding about the logic of ad placement.

You say they don't want it randomized, but if not then what is their take on how the ads should be placed? What decides that this ad goes to that thread, but the other thread shows a different ad? They surely must have some sort of algo in mind.

Another question is the relation between the number of threads and the number of adds. I took a look at your pages and I can see some ads there. Looks like there are 4 links per thread (right below the navigation buttons). Are these already a part of the deal, or are we talking about a different set of ads.

Back to the relation. This is a simple proposition of the logic for ad placement.
Say you have 700 ads, but way more topics. One approach could be this:

1. each topic has a unique ID

2. each ad could be placed in a database and would also be assigned an unique ID (from 1 to 700)

3. topic #1 gets ad #1, topic #2 gets ad #2 and so on untill you reach the number 701.

4. When the topic # is >=701 then you do this algo:

[code:1:2f94626c55]integer TN //current topic number
integer NA //total number of ads
integer AD //ad to display
if NA = 0 then
exit //division by zero, and no ads to show
if TN <= NA then
AD = TN
else
AD = TN mod NA
if AD = 0 then //do this condition if ad counting
AD = 1 //starts from 1, not 0

[/code:1:2f94626c55]Example:
Assume that
Total Number of ads is 700
ID of topic to display is 701, so

(701 mod 700) = 1
ergo, topic with ID 701 will show ad #1

another one (just playing here):

Assume that
Total Number of ads is 700
ID of topic to display is 12345, so

(12345 mod 700) = 445
ergo, topic with ID 12345 will show ad #445

With just a few keystrokes this algo could be modified to provide for the display of more than one ad, the way you do it now.

Note:
If the number of topics remains static (700) then a thread will always show the same ad. Logically, it follows that every time an add is added to, or removed from the database, some threads will no longer show within the topics where they did before. This will concern mostly topics whose numbers (or even multiples of numbers) are within the range of the change in the number od added/removed ads. Sounds complex, but really isn't. I guess my English is failing me here.

Anyway, what I suggested above is not randimizing, so the placement of ads is predictable.

<edit: supplemented to provide for AD = 0, and spelling too>
littleFella is offline   Reply With Quote