Closed (fixed)
Project:
Views Rotator
Version:
6.x-1.0-alpha2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Jan 2009 at 03:08 UTC
Updated:
9 Feb 2009 at 12:11 UTC
Hi there,
I was trying to call Views Rotator's block manually, according to Placing the contents
of a block in any location - but it doesn't work:
<?php
$block = module_invoke('views_rotator', 'block', 'view', 0);
print $block['content'];
?>So, what works? :]
Szy.
Comments
Comment #1
Aart commentedAccording to my research, invoking the block doesn't work with views. You have to embed it. However, I tried two methods and neither succesfully loaded the rotator. Just a normal view.
This topic [http://drupal.org/node/309017] supposedly has a solution for D5 users.
If someone could 'translate' this fix to D6/Views2, I would be extremely grateful!
Comment #2
mfer commentedYou are looking at embedding it directly into a page? Like a page.tpl.php file?
If that's the case you want to use views_embed_view to embed it. Now, you don't want to call this directly in your template.php files. This will add JavaScript to a page and if the JS is already added to the header it can't be altered.
So, what you need to do is have a template.php file. In there have something like.
Then in your page.tpl.php file place the $my_embedded_view variable where you want the view.
Comment #3
Aart commentedThank you for your reply.
I am a bit confused though about how exactly this 'phptemplate_preprocess_page' function works.
The argument passed (&$vars) is a pointer to an array with multiple views, but the 'views_embed_view' function will only return the
'my_view' content and places it on the 'my_embedded_view' position.
It is not clear to me how this would generate content with embedded javascript.
Could you clarify the usage of this function with a simple call and print example?
Comment #4
szy commentedMy working solution for two different rotated views, thanks to mfer! :]
In template.php:
... where my_rotated_view and my_another_rotated_view_on_front are names
of my views build with Views Rotator style.
Then in page.tpl.php in place where I want to see the view:
<?php print $my_rotated_view; ?>... and in page-front.tpl.php:
<?php print $my_another_rotated_view_on_front; ?>More - in mycustomnode-node.tpl.php:
Szy.
Comment #5
brenes commentedHmm its not working in my case. I edited my template.php with the following lines
called the variable
<?php print $imagerotatortest; ?>in page-front.tpl.php but nothing is showing on the frontpage. "imagerotatortest" is the name of my view containing the views rotator design.Any suggestions how to make it work?