This problem occurs with "test mode" enabled. Using "display: table-cell" causes the width of the div to expand to accommodate the publisher ID, which is rather long. See attached screen shot.

Changing the element styles to the following fixed the problem...

  return "<div class='adsense' style='text-align:center;display:block;overflow:hidden;vertical-align:middle;border:solid 1px;${dimensions}'>${text}</div>";

This is line 600 of adsense.module (Drupal 7), and line 595 in Drupal 6. Note that in addition to making it say "display:block", I also had to add "overflow:hidden". That makes the publisher ID get truncated, but better that than have the box be too wide.

If I might suggest a better fix, though... just eliminate publisher ID from the display. Slot ID and height/width are more important, but my publisher ID is the same for the whole site. I don't need to see that in every ad box - especially in my sandbox site.

CommentFileSizeAuthor
adsense-screen-shot.JPG40.81 KBExTexan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcnventura’s picture

Thanks for the info. I have to say I don't know what I was thinking when I hard-coded CSS into the module, now that I look at it.

I'll change the display to 'inline-block', as that does what I need it to do, which is to create a box with the specified width. I'll also add overflow: hidden and word-wrap: break-word to make sure that text stays inside the box.

As to the client info being there, there two reasons for it:
1) it is useful in test mode to display all the variables that would be in the google javascript;
2) for users of the revenue sharing module, this value would not be a constant.

Even though the fix itself is easy, I'll solve this by doing the right thing and adding a CSS file and removing the hard-coded styles, so it will take a while longer.

jcnventura’s picture

Status: Active » Fixed

I've now moved the CSS to a separate file.

http://drupalcode.org/project/adsense.git/commit/d69947c

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.