comparison weight/percent/ad_weight_percent.inc @ 0:d8a3998dac8e ad

ajout module ad
author pierre
date Fri, 20 Feb 2009 14:04:09 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d8a3998dac8e
1 <?php
2 // $Id: ad_weight_percent.inc,v 1.1.2.2.2.2 2009/02/16 17:06:50 jeremy Exp $
3
4 /**
5 * @file
6 * A plug in for the ad.module, providing a percentage based weighting mechanism
7 * for the random selection of ads.
8 *
9 * Copyright (c) 2007-2009.
10 * Jeremy Andrews <jeremy@tag1consulting.com>.
11 */
12
13 function ad_weight_percent_select_ad($ads, $quantity, $invalid) {
14 $tid = NULL;
15 if (adserve_variable('tids')) {
16 $id = adserve_variable('tids');
17 $tids = explode(',', $id);
18 // A group can only be comprised of one tid. If multiple tids are defined,
19 // then we're not working with a group.
20 if (sizeof($tids) == 1) {
21 $tid = $tids[0];
22 }
23 }
24 else if (!adserve_variable('nids')) {
25 // The default group.
26 $tid = 0;
27 }
28
29 // Only do something if we're currently processing a specific ad group.
30 if ($tid !== NULL) {
31 // TODO: The percentage information needs to be stored in the file cache,
32 // as obviously we don't want to bootstrap the database layer and perform
33 // a query at this point.
34 }
35 }