It would be useful to be able to embed ads in Drupal generated content, not just in blocks or themes. The implementation is simple enough, but I'd like to propose a format here allowing people to comment if they have ideas for improvements.

The idea is to support three formats of embedded ads:

  1. Auto-embedded ads, embedded a certain number of characters into all content, or selected types of content.
  2. Manually embedded ads using a [[ad]] tag.
  3. Manually embedded ads using a <--ad--> tag.

For manually embedded ads, the following format would be applicable:

  1. Must start with <--ad, or [[ad
  2. Paramaters must be seperated by |
  3. Parameters entered in variable=value1,value2,value3 format
  4. Supported parameters: group, quantity, hostid, nids
    • group = randomly select and ad from this group
    • quantity = specify how many ads to select from group or nids
    • hostid = unique id to log views and clicks under
    • nids = randomly select ad from list of ads (each ad has a unique nid)
  5. If nids are specified, group will be ignored
  6. Must end with -->, or ]]

Examples:

  • [[ad]]
    Will embed one random ad from the default group.
  • [[ad|group=text|quantity=2]]
    Will embed two random ads from the "text" group.
  • <!--ad|nids=34,231,6553,12-->
    Will display one random ad selected from list if nodes 34,231,6553 or 12 (listed non-ad nids will be ignored)

Notes:
If using <!--ad--> style for embedded ads, you will have to be sure that your input format allows this tag, or enable the "Full HTML" input format. An advantage to using this tag is if you later disable the ad module, your embedded ads will simply disappear as they will be html comments.

The [[ad]] style for embedded ads does not require any modifications of the input format, and thus will be easier for some to use.

The implementation will be to replace these tags with the appropriate javascript. This will be implemented as an add-on node, not part of the core ad.module. Thus, those that do not desire this functionality will not suffer any overhead.

Comments

jeremy’s picture

Assigned: Unassigned » jeremy

An initial implementation of manually embedding ads in content can be found in CVS in the ad_embed.module. It works as described above. The module still needs support for automatically embedding ads in content, to be implemented next.

jeremy’s picture

Status: Active » Fixed

Automatically and manually embedded ads are now fully supported with the ad_embed module.

Anonymous’s picture

Status: Fixed » Closed (fixed)
marcoBauli’s picture

Category: feature » support

Embed ads works a treat here!

Only thing i'd like to output them also on templated nodes (via Contemplate module or standard node-type.tpl.php template file).

Can Jeremy or other php savvy please help with the code to include in the template file?

Many thanks in advance

marcoBauli’s picture

Status: Closed (fixed) » Active
jeremy’s picture

Status: Active » Closed (fixed)

Please open a new issue for new requests, do not make new requests in old issues.