Is there a way to add Adsense into the main content area (not just above or below articles). Having adsense (or other affilitate programs) show up inline with posts. An example:

########### Post starts and wraps around Ad
###########
###########
###########
ADVERTISMENT#
###########
###########
###########

Post continues

Comments

Abilnet’s picture

Take a look at the excellent AdSense module:
http://drupal.org/project/adsense

"...A new feature has been added to allow placing ads in any place in the
content..."

adnanshareef’s picture

one solution would be to edit each and every post, set input method as php and call the adsense function adsense_display. But, this is not a general solution so that you could apply it on each and every node with one line of code.

Another solution could be to modify node.module. I would recommend to follow it when no other solution works for you. When node.module is picking the post/page/etc data from the db, you just embed your respective affiliate/ad code in the middle. This is a direct modification in the codebase, not some customization through GUI, so its risky. But ive done it by myself and it works.

The perfect solution would be some block that could be placed within the node body at the selected position. But i didnt find any.

I would expect some better solutions than above in the upcoming posts from others

Adnan Shareef

syawillim’s picture

These posts might be of some use to you http://urlgreyhot.com/personal/weblog/drupal_tip_2_sprinkling_ads_throug... & http://drupal.org/node/57094.

www.justapickle.com
blogging community for the socially conscious

www.slickfish.com.au
professional, affordable web site design, production and maintenance for small business

bsherwood’s picture

thanks for the help everyone

tmj2k7’s picture

The adsense module has this feature built in. Enable the adsense filter for your input level and you should be able to do it. I believe it is in the adsense module docs some where.

www.thelinuxuser.com

venkat-rk’s picture

And, here is a list of useful resources if you are using Kbahey's adsense module for drupal:
http://baheyeldin.com/technology/drupal/resources-for-using-google-adsen...

kbahey’s picture

I am the author of the adsense module, so what I am going to say applies to those using the module.

Each ad is wrapped in a div that has and id of "adsense". You can use that, or enter you own divs around a tag, and use css to align the ad correctly (e.g. float: left).
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

brianV’s picture

If you really want to make it easy, do a search for the 'Contemplate Module' - this will allow you to create custom templates for any content types.

Now, install the Adsense module, and create a template with

<div id="adsense" style="float:left; margin; 10px;">Adsense Module Code</div>

in the first line of your template. This will place the adsense in the top left corner of the content, kind of like I did here: http://www.free-journal-articles.com/bvuyk/review-of-the-zero-by-jess-wa...

Good Luck!
--
Drupal Pages I've Designed:
http://www.free-journal-articles.com
http://www.outfrontps.com
http://www.infohatter.com

My Blog: http://www.infohatter.com/blog

Willdex’s picture

Ok, I've inserted float:left into <div style="border: 1px solid ; width: 468px; height: 15px;">AdSense</div> in the FireBug, so now I have <div style="border: 1px solid ; float: left; width: 468px; height: 15px;">AdSense</div>, and it works perfectly, but where do I save the changes to? Which file?
I think I need to insert some sort of option into

  $output  = '<div style="';
  $output .= ' width:'  . $width  . 'px;';
  $output .= ' height:' . $height . 'px;';
  $output .= ' border:solid 1px">' . $placeholder_text . '</div>';

to be able to put either float: left, float: right, or float: center into [adsense:468x15:1:1]. Am I correct?
--
Billy | Major: Accounting | CityTech@CUNY | Student Block.

dzynz’s picture

I only get blank space or a digit when I use the adsense php code, and the tag, unprocessed, if I use it in the Contemplate.