Downloads
Release notes
OVERVIEW
This version integrates a number of features I've been working on over the last year or so. It is intended to address issue #141096: Inject adsense into content and #1301610: Remove AdSense module dependency, and provide a platform for ongoing new feature development.
If you are upgrading from 6.x-2.x versions, please read the known issues/installation notes, below!
MAJOR NEW FEATURES as of October 6, 2011
- Now supports XPath-based insertion for inline ad insertion.
The default XPath expression is /html/body/p[3] which will insert the inline ad insertion template *after* the third paragraph of the node body, at the root level. This avoids insertion inside nested (descendant) elements.
At present, insertion is always done using ->appendChild() method of the element returned as a result of the XPath expression. This means that it's impossible to insert _before_ the found element. This limitation may be lifted in a future release.
- "Top" and "bottom" insertion.
You can now specify "TOP" and "BOTTOM" insertion templates, which will be inserted at the top or bottom of the node body, respectively. This method uses the body's 'content' fields with weights (top = -6, and bottom = 10).
There is no way to alter these weights via the adsense_injector admin settings page, but you can set the variables 'adsense_injector_front_weight' and 'adsense_injector_back_weight' manually if you like. (Note: These variable names are likely to change in the future if and when these weights are exposed via the admin settings page.)
- Manual (per-node) insertion point control.
Now supports manual insertion point selection (using a new [ai:insertion:inline] tag). The 'inline' template will be inserted at the point where this tag appears.
- Manual blocking of injection on a per-node basis:
Now supports manual "no inject" (using thecomment or other occurance of 'ai:noinject' within first 512 characters of node body.)
Note that HTML comments are filtered out by the HTML filter and other filters, so you might need to use something like
or any other HTML tag allowed by the node's input filter. (Oh, it would be so nice if Drupal's core HTML filter and HTML Corrector filter allowed HTML comments to pass through...)
See: #222926: HTML Corrector filter escapes HTML comments
and #103563: HTML filter escaping html comments - Removed AdSense module dependency.
That's right, you don't need the AdSense module to use AdSense Content Injector. If you don't have the AdSense module enabled, you won't be able to use the [adsense:xxx] tags in your templates. You can use raw JavaScript to inject Google AdSense ads. Your choice.
See: #1301610: Remove AdSense module dependency
Installation notes and known issues
BEFORE YOU INSTALL THIS VERSION
If you've been using 6.x-2.x releases, you should disable node body insertion in page views before you upgrade to this version. This will allow you to update the module settings after you install the new version.
You will have to re-create your node insertion template. The template syntax has changed (%body token no longer available). Copy your old insertion template into a text editor before you install this version, remove the %body token, and update the template as needed.
The default inline insertion point is after the third top-level paragraph of the node (this is controlled by the inline insertion XPath pattern field.) You can change this by altering the XPath pattern. I will write up a handbook page about this soon.