1

I am working on Drupal 6. I have a view with a display block. My view contains an animation of 6 images with slideshow as Style.

If I put the block in the content the view works fine, the images changes. However, when I call the same block from template the images not change, I can see only one image. What is my error?

my code is:

<?php
$block = module_invoke('views', 'block', 'view', 'images_home-block_1');
print $block['content'];
?>

Also, I tried this code:

<?php 
print views_embed_view('images_home', $display_id = 'block_1'); 
?>

Thanks in advance.

1

try your views block inside a theme region.

  • Hi, Thanks for your answer. This solution works for me!!! – cabita Jan 9 '13 at 16:38
1

you can try views_embed_view to call a views block programatically.

views_embed_view

<?php
print views_embed_view($view_name, $display_id, $argument); // with single argument
print views_embed_view($view_name, $display_id, array($arg1,$arg2,$arg3)); // with multiple arguments
?>
  • I have tried the follow code: <?php print views_embed_view('imagenes_home', $display_id = 'block_1'); ?>, and the view slideshow doesn't work. Thanks for your answer and your help. – cabita Dec 18 '12 at 10:12
1

Define variables on template.php

<?php
  function bluemarine_preprocess_page(&$variables) {   
      $variables['slideshow'] = views_embed_view('images_home', $display_id = 'block_1');     
  }
?>

Now you can print this variables on page.tpl

<?php

     print  $slideshow;     

?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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