Template theming around Adsense blocks
| Project: | AdSense |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | MadKad |
| Status: | closed |
Jump to:
This patch adds two things to the current adsense.module
Theme Support
To add greater control to the look of a site featuring Google's AdSense i've added a new Drupal theme function.
Theme designers can now add additional HTML around the Adsense block as required.
This replaces the recent inclusion of a <div class="adsense">...</div> in the adsense.module
The benefit of the theming function is to add markup such as images above or next to the adverts, some consider this helps attract attention to the adverts.
The patch also implements some slight changes to the caching intelligence. Generated adverts are now no longer cached if the placeholders are in action. What's the point in caching the placeholder?
Filter
The filter system of Drupal caches processed text when nodes are saved to the database. Because of this the current Adsense filter failed if uid #1 was editing the nodes. All nodes would always show a placeholder.
This patch adds a switch when processing ads for the filter, so that the ad will always get generated.
The side effect is that uid #1, and anybody who has "hide adsense" permission WILL see the ads embedded in a node body.
There doesn't appear to be a way around this using the current Drupal filtering system.
Adsense in blocks will continue to operate as before, featuring a placeholder for uid #1 or anybody with "hide adsense" permission checked.
| Attachment | Size |
|---|---|
| themeads.patch | 7.56 KB |

#1
will this work on the 4.6.0 as i am having the same problem
#2
The patch I submitted was against the current CVS code. Please don't change the version tag.
I've not looked at 4.6 Adsense module, although you can probably back port my fix to 4.6.x
#3
Do you have any plans to backport the patch to work with 4.6.x? I don't know how to do this. I believe that I'm experiencing an issue in 4.6.9 that would be fixed by the themeads.patch. When I insert an adsense tag into node content, the ads don't work until I go to the input formats settings and simply hit the "save configuration" button next to the adsense tag weight setting. I don't even need to change the weight setting. Thanks for your help.
#4
budda
This is a valuable patch, but is now out of date since adsense.module changed significantly.
Can you please re-roll it from the current HEAD or 4.7?
#5
I found a workaround with my 4.6.x adsense issue. I just add adsense tags through the administer, content screen. If I edit a node through that screen and submit the changes, it doesn't show me the changes. It just goes back to the administer, content screen. This keeps the adsense placeholder box from getting cached while logged in as user 1.
#6
howdy, i'm looking also for more themability,
and have as well some problems with style.css loading that could be connected with caching (?),
so bumping this, ty
#7
The patch is too messy. Bumping the issue won't fix it. What is needed is a patch for the current code that just handles theming.
#8
#9
This might be useful also in the new code..
#10
I have just added some code to theme the div wrapper of the adsense ads. This will be in the dev version in a few hours.
The filter to prevent caching is unnecessary, as the new code doesn't use caching.
João
#11
Automatically closed -- issue fixed for 2 weeks with no activity.