This problem occurs when AddToAny is used in conjunction with Views (Views 2, d6.15).

I am using the AddtoAny block to display links for each page on the site. When that link is used from a View page, the link that's shared is the link to the first item in the View, not the current page.

Each of these Views is created using the Node view. When I use the link that's output with each node, what I end up sharing is not the node that link was output with, but the next node in the view.

For example, given View displayed as /x, and showing nodes /1, /2 and /3:

The AddToAny link in the block will share /1
The AddToAny link displayed in View row 1 will share /2

For Views using the row-type Field, the AddToAny link in the block simply shares the home page.

I will test the row-scope behavior where row type is Fields -- I have reason to believe this won't be a problem there. I will also test the case where the block is not displayed, either because it's globally or locally disabled.

Note that AddToAny is the only thing in the View rows that's linking to the wrong item.

Comments

escoles’s picture

If the block is suppressed using standard block exclusion rules, then the AddToAny link in each View row will share the item shown in that row. So it looks like an array is getting partially iterated.

I also tested this on a Field row-type. Since I have to create an AddToAny link by re-writing the NID field, each row's AddToAny link works as expected. (I.e., I'm not using the AddToAny module to create the link.)

Here's the rewrite snippet I use in Field views, in case anyone's curious:

<ul class="links inline"><li class="addtoany first last"><span>
      <a class="a2a_dd" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fnewsroom.tesselaar.com/node/[nid]&amp;linkname="><img src="/sites/all/themes/coolplus/images/share-icon-16x16.png" alt="Share/Save"></a>
      </span></li>
</ul>

This actually works quite nicely, since Drupal automatically returns the alias. (Using GlobalRedirect and assume that's why.)

Suspect I can get a workaround by creating a block that does the same think, which would not decrement the array.

micropat’s picture

Status: Active » Closed (cannot reproduce)

Have you tried the latest version of AddToAny? :)