Ads display when not grouped, but trying to display ads by group doesn't work
evansface - May 1, 2009 - 18:34
| Project: | Advertisement |
| Version: | 6.x-2.0 |
| Component: | ad module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
When I create ads and don't assign them to a group, I can easily display them with the simple
<?php
print ad();
?>But when I try to put ads in a group (we'll call the group "5") and display an ad with
<?php
print ad(5, 1);
?>(which is how it says to do it on http://drupal.org/node/394340) nothing shows up. I'm not sure if something is broken or if I'm just doing something stupid (I'm leaning toward the latter). Any ideas?

#1
You will need to pass in the term_id for your group if calling ad() manually. Is your tid 5? If so, then what you have done should work. If not, then use the tid, not the name of your ad group. One way to find the tid of your group is to go to the ad groups admin page and click "edit" by the group name. Now, look at the path and the # in that path is your tid. (admin/content/ad/groups/#/edit). You only need to pass one parameter, by default it will only display 1 advertisement. In other words, ad(5) and ad(5, 1) mean the same thing.
#2
Using the tid works like a charm - thanks so much Jeremy, you just made my day so much better!
#3
Automatically closed -- issue fixed for 2 weeks with no activity.