function ad_weight_percent_select_ad in Advertisement 6.2
Same name and namespace in other branches
- 5.2 weight/percent/ad_weight_percent.inc \ad_weight_percent_select_ad()
- 5 weight/percent/ad_weight_percent.inc \ad_weight_percent_select_ad()
- 6.3 weight/percent/ad_weight_percent.inc \ad_weight_percent_select_ad()
- 6 weight/percent/ad_weight_percent.inc \ad_weight_percent_select_ad()
- 7 weight/percent/ad_weight_percent.inc \ad_weight_percent_select_ad()
@file A plug in for the ad.module, providing a percentage based weighting mechanism for the random selection of ads.
Copyright (c) 2007-2009. Jeremy Andrews <jeremy@tag1consulting.com>.
File
- weight/
percent/ ad_weight_percent.inc, line 12 - A plug in for the ad.module, providing a percentage based weighting mechanism for the random selection of ads.
Code
function ad_weight_percent_select_ad($ads, $quantity, $invalid) {
$tid = NULL;
if (adserve_variable('tids')) {
$id = adserve_variable('tids');
$tids = explode(',', $id);
// A group can only be comprised of one tid. If multiple tids are defined,
// then we're not working with a group.
if (sizeof($tids) == 1) {
$tid = $tids[0];
}
}
else {
if (!adserve_variable('nids')) {
// The default group.
$tid = 0;
}
}
// Only do something if we're currently processing a specific ad group.
if ($tid !== NULL) {
// TODO: The percentage information needs to be stored in the file cache,
// as obviously we don't want to bootstrap the database layer and perform
// a query at this point.
}
}