I have several different blocks some created directly in site building> blocks, and others creating using Views. I'd like to randomly display one of these blocks (on specified pages) each time a page is refreshed. I believe I can do this by creating a custom block and using PHP but I'm not sure about the PHP portion.

I'd really appreciate some help.

Thanks.

Comments

cog.rusty’s picture

Lloyd’s picture

I'm actually using Views Slideshow, which is similar to rotor. I don't think Views Slideshow can accommodate what I need. Not sure about rotor. The problem is that there are blocks created using Views, and blocks created directly in the block system. And I'm actually using Views Slideshow to rotate content within individual blocks.

So, I have block one created using Views and Views Slideshow is rotating through several nodes. I have another block the same way but using different content type, different fields, different filters, etc. And I have a third block created directly in the block system.

I can't display all 3 blocks on the same page as it takes up too much real estate. So I'd like to only include one of the 3 blocks, randomly, and refreshed when the user refreshes the page.

cog.rusty’s picture

See this comparison page:
http://drupal.org/node/418616

I think the "Dynamic display block" module (not the "Views Slideshow Dynamic display block") supports "block instances". I guess that means "if it is a block, will do, no matter where it came from". And the module's statistics are good, which basically means that it works.

The "Rotor", also somehow popular, is not listed there. I took a look at their home page but I was unable to read it, because their typography was too advanced for me.

Lloyd’s picture

Thanks

AshokanKid’s picture

Hi;

I was looking for a similar same thing, wanting to rotate content within a block, and I found this PHP code snippet that works perfectly and is simple to create and maintain;

http://www.devdaily.com/drupal/custom-drupal-php-block-example#comment-1395

We are using this to serve external ad code rotated with our own JPG code links. Thanks to Alvin @ devdaily.com for this.

AK