Using the Drupal Advertistising Module: Centering and other Changes

Just installed the interesting Drupal Advertising Module by Jeremy at Like Drupal, the module seems to be powerful, but configuring it is a bit of a pain since you need to visit so many different administrative sections to get it all up and running. Having said that, it seems to be pretty good and I will be putting it into production here in the near future to supplement Adsense earnings.

So, what I was trying to do was run the ad in a block. The problem here is that it doesn't allow you to modify the HTML code before the Javascript that it uses so that I could center the image ad in the block.

The hack solution to this problem for me was to generate an "external" ad link, which the module allows you to do so that you may run the ad on multiple websites on other installations of Drupal, or anywhere else I would imagine. So, I created a regular Block and then put in this code for an externally placed ad inside <center></center> tags.

Is there a better way of doing this? Probably, but this seems to have worked for me, and offers me some flexibility for the future in case I wish to change something else as well with HTML.


Just to update, I was able

Just to update, I was able to get it centered with (what I think to be) proper CSS by:

1. Opening my theme's style.css file and adding at the bottom:

.advertisement {margin:3px 0px; padding:0px;
#Content {
    margin:0px auto;
    border:1px dashed #333;

You can fiddle with the numbers if you like to adjust various factors. Like I said before, I don't really know CSS too well (another project for summer) 

Hey,Thanks for the reply. I


Thanks for the reply. I figured there probably was a better way, I just found a quick-and-dirty way, especially since I'm not all that familiar with CSS (or even HTML for that matter), such is what I like about Drupal :)


Centering, etc

The intention of the module is that you use CSS to do things like center advertisements. There are some basic CSS examples included in the README file that comes with the advertisement module. The same CSS classes are available to you whether you display ads in JavaScript mode or Raw mode.  Thus, it can simplify things to switch to Raw mode while you do your theming so you can see all the classes -- then, when things look how you want them, you can switch back to JavaScript and your theming will continue to work just fine.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <p> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options