Posted by ruminir on September 7, 2012 at 6:33pm
Hello Everyone.
Now I'm trying to set Random Blocks in my Drupal Site.
The code is very simple and it's added in the page.tpl.php.
Something like that:
<?
$variable_random = rand(1,2);
if ($variable_random == 1)
//Show Adsense Block #1
else
//Show Adsense Block #2
?>
So far so good, but this only works when Caching mode: is Disabled, because Drupal loads the page.tpl.php every time that the pages is loaded.
So my question: is there any way to do this using the Caching mode: in Normal Option?
I would appreciate any help.
Comments
Instead of adding that to the
Instead of adding that to the page tpl I would do it all in a custom block (in your custom module) and if cacheing is an issue, set the cache (DRUPAL_NO_CACHE) in your hook_block_info - see http://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_info/7
Thank you. But I'm working
Thank you. But I'm working in Drupal 6.
http://api.drupal.org/api/dru
http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_block/6