Hi,
I've been trying to get this to work for a few hours, but to no avail.
I have the adsense module setup already on my Remove Stain site, but I can't get the content injector to work properly.
I'm trying to achieve the following:
- Inject a 336x280 ad unit
- Have it appear after the ~400th word
- Have the ad unit float on the right
- Automatically do this for all articles
I know the adsense tags work fine.
Can someone post a snippet example of what I should be entering in the List ad insertion template * area?
I would really appreciate this because I can't get anything to inject and I'm confused at this point.
Do I need to do anything to my theme files? Maybe I'm missing something completely.
Cheers,
CP
Comments
Comment #1
marcoka commentedafaik this is not possible, the xpath only uses after the nth
tag
Comment #2
CarbonPig commentedHi e-anima,
I don't quite understand your explanation/answer.
Is it possible to inject an adsense ad somewhere in the middle of a body field in drupal 7 and have it float on the right?
What do you mean by nth? Could nth not be 400 or 200??
Thanks,
CarbonPig
Comment #3
marcoka commentednth means the
tag. standard uses 3rd.
Comment #4
CarbonPig commentedI appreciate your help, but I'm still confused.
Is there a way to inject an adsense tag into the middle of the body somewhere and have it float right or left?
Noobie,
CP
Comment #5
mcurry commentedI understand that this can be confusing.
The answer to your last question is yes. But you can't select words, you can only select an insertion point using valid xPath expressions, which allow you to select an insertion point following a specific HTML element. As far as I know, words are not selectable using xPath expressions. Paragraphs are, so you can select an insertion point after a certain number of paragraphs (which is how the default settings work.)
Once you have an insertion point using an xPath expression, you can insert any content you want, including floated right or left divs. This is what I'm doing using Content Injector on this page. I'm using an inline insertion xPath expression
/html/body/p[3], which selects an insertion point just after the third paragraph of the node body. I inject a floated left DIV which contains the AdSense code.I'm afraid I can't provide much more information on xPath expressions -- perhaps someone else can chime in and add to the module documentation.
If you want to insert after a certain number of words, the module doesn't do that at present; you should open a feature request issue and I'll consider adding it for a future release.
Comment #6
mcurry commentedAlso, if you upgraded Content Injector from a prior version, you may need to uninstall and reinstall to reset the module settings. See #1342142: Cannot configure node body insertion template settings after upgrade to 6.x-3.0.
Comment #7
Fred8 commentedI have difficulty in using it in anywhere else than in the standard "body" field. I have a custom content type where I have HTML long text field called field_description . When I set the XPath as /html/field_description/p[1], it does not appear in the required field. And, the field has many p tags.
Comment #8
greg boggsIn case others happen on this thread. The module currently only supports injecting into body fields. See: #257406: Support content type without body field.