Show and hide adsense blocks randomly

thebrotherofasis - March 27, 2009 - 12:42

Hello,

I created some adsense ads through the adsense module in drual 6. Now, I have to adsense blocks: one for links, and the other one for images (graphic ads).

What I would like to have is my ads blocks displayed, once one of the adsense links block, and the other time, the graphic ads block. This is, I would like to be able to make Drupal randomize the presentation of these two blocks.

Any ideas of how this would be possible?

I don't know much php, but I do see that at the bottom of the block, it says "show block on specific pages", and then it gives me the option of:
"Show if the following PHP code returns TRUE (PHP-mode, experts only)."

Could someone help me figure out a way to do this?

Thank you very much.

_

WorldFallz - March 27, 2009 - 14:15

Since the blocks are independent, I don't know how you could do this with block visibility code. I would think you would need to put the logic in the page.tpl.php file and use the php rand function to select which block to print.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

 
 

Drupal is a registered trademark of Dries Buytaert.