Closed (fixed)
Project:
Advertisement
Version:
6.x-2.0
Component:
ad module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2009 at 08:08 UTC
Updated:
18 Aug 2009 at 22:00 UTC
Hello,
I am trying to determine with easiest way to make an ad appear for a particular taxonomy, From your README.txt file I found the section that discusses Displaying Ads from PHP:
------------------------
Displaying ads from PHP:
------------------------
To display an ad from within PHP code, make a call to the ad() function.
You can optionally specify an ad group, the number of ads to display, and
several other options. For example, to display one random ad from all ads
that have not been assigned to any group you don't have to pass in any
parameters:
<?php print ad(); ?>
To display two ads from all ads that have not been assigned to any group
you would execute the following code:
<?php print ad(0, 2); ?>
(The first parameter specifies the ad group to display ads from. By
specifying 0, we are telling the ad module to display ads that are not
assigned to any group. The second parameter specifies the number of ads
to display at one time.)
To randomly display an ad from a specific group of nids, for example with
the node ID 69 or 76, you would pass in the following parameters:
<?php print ad(NULL, 1, array('nids' => '69,76')); ?>
(When specifying specific nids, any specified ad group is ignored, so we
leave the first parameter as NULL. The second parameter causes only one
ad to be displayed at a time. And the third parameter is an array that
tells the ad module to randomly display either ad 69 or ad 76.)
To display and ad randomly selected from multiple groups you can simply
specify multiple groups separated by commas. For example, to display 3
ads from groups 24, 56 and 98 you would pass in the following parameters:
<?php print ad('24,56,98', 2); ?>
You can also specify how to display a given ad. Current display methods are
'javascript', 'jquery', 'iframe', and 'raw'. When using the 'javascript',
'jquery', and 'iframe' methods, ads will randomly change even when the Drupal
pagecache is enabled. When using the 'raw' method, ads will only change when
the Drupal pagecache is flushed.
To force one ad with a tid of 76 to display using JavaScript you would pass
in the following parameters:
<?php print ad(76, 1, array('method' => 'javascript'));
To force two ads with a tid of 101 or 102 to display using the Raw method
you would pass in the following parameters:
<?php print ad('101,102', 76, array('method' => 'raw'));
I believe this PHP belongs in the Block section entitled: "Show block on specific pages," is that correct?
Assuming the Ad has an id of 1983 and the tid of the term that I would like the ad to appear in is 54, how would I write the PHP code?
Is there an easier way?
Thanks,
sam
Comments
Comment #1
jeremy commentedThis PHP belongs some place where PHP will be executed and the resulting output will be displayed. This PHP should not be added to the "Show block on specific pages" section.
It's not clear to me what you're trying to accomplish, however. You want one specific ad to display on a specific page? Or on all pages matching a specific taxonomy term? Or something else?
Comment #2
jeremy commentedNo further feedback. I guess you figured this out. Closing issue.