I am using the Dynamic Display block to show article nodes and I would like to include the Plus1 Voting widget on the slider text panel.

I can display the widget using print plus1_jquery_widget($node,0,0);
but the as the $node argument is not displayed in the URL the widget does not function.

Anyone know how I can pass the node id of the active slide into this function?

Comments

ppblaauw’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc6
Status: Active » Postponed (maintainer needs more info)

You can change the following line:

          $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;

to

          $slider_items[$key1]['slide_node'] =  $result->nid;

In the ddblock content preprocess function in the template.php file of the theme you use.

Now the $slide_node variable is available in the ddblock theme

In the ddblock theme file: ddblock-cycle-pager-content-[theme_name].tpl.php you can no use:

print plus1_jquery_widget($slide_node,0,0); 

Hope this helps you further, please let me know.

PS.
I put the version to RC6, Dev version is for testing new functionality.

teh_catt’s picture

thanks for the reply.

I still couldnt use the $slide_node variable in the .tpl.php - it came up empty but I could see the correct result of print $slider_item['slide_node']

Unfortunately this didn't work when passed to the plus1_jquery_widget and the widget retruned the same result for all nodes. I think this is an issue with Plus1 rather than DDB so I will ask there as well.

Many thanks for our help and for the great Dynamic Display Block module which after mcuh blood sweat & tears is looking great!

teh_catt’s picture

ppblaauw’s picture

Ok, I misread the code for the plus1 widget, probably it needs the whole node object instead of the node-id.

Which module is used for the plus1 functionality.

teh_catt’s picture

It is this one:

http://drupal.org/project/plus1

You can see it on my DDB here:

http://community.retrobabble.com

It should show the number of votes for each node and have an 'UP' arrow if a user hasnt voted.
At the moment it only shows one vote for each item and doesnt work if you click the UP arrow to vote.
If you click through to the full node you can see it works correctly on the full node page.

ppblaauw’s picture

I had a look at the plus1 module and you need to pass the whole $node object, not just the node Id.

You can accomplish this by loading the node in the preprocess function.

$slider_items[$key1]['slide_node'] =  node_load($result->nid);
teh_catt’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

You sir, are a hero!

That works perfectly now.

Many many thanks for taking the time to help me! :-D