1

I want to create footer block through custom module and want to add five images through node.Five images should change one by one after one hour.

Can anybody tell me how to do this ?

<?php


function chat_block_info() {
  $blocks['chat_footer'] = array(
    'info' => t(' FOOTER'),
    'cache' => DRUPAL_CACHE_GLOBAL,
  ); 
  return $blocks;
}

function chat_block_view($delta = '') {
  $block = array();

  switch($delta) {

    case 'chat_footer' :
      $block['chat_footer'] = array(
        '#markup' => chat_footer_block('footer'),
      );
      break;
  }
  return $block;
}

function chat_footer_block($parm) {
 if ($param == 'footer')
 {
   $node = node_load(11111);
    $uri_top = $node->field_footer_image['und'][0]['uri']; 
    $alt_top =$node->field_footer_image['und'][0]['alt'];
   $image_top = theme('image_style', array('style_name' => $footer_chat,
        'path' => $uri_top,
        'getsize' => TRUE,
        'alt' => $alt_top,
        'title' => "IMG"
      ));

}

}

1 Answer 1

0

To accomplish this I would probably use a combination of hook_cron() to check in every hour, persistent variables to track the last loaded image (see variable_set and variable_get) and the great Ajax Blocks module so that your block is refreshed without having to rebuild the entire page each time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.