Implementing Stocktwit Share in php loop?

210 Views Asked by At

I am working on a site and I require that stocktwit share button appears against each post which are running in loop. i tried integrating the share button from the stocktwit site. The first button is working fine, it fetches the data i m providing in the "data-text". But for the rest they simply open a share screen with no values fetched. Please suggest how I should use the share button in a loop?

1

There are 1 best solutions below

2
On

If I understand this correctly you are trying to have multiple share buttons on one page. You can go about this 2 ways.

Using the share button coded as so should work:

<a href="http://stocktwits.com/widgets/share" class="stocktwits-share-button"><img src="https://stocktwits.com/assets/widget/stocktwits_share.png" alt="Share on StockTwits"/></a>

The issue you are seeing is because of the multiple button ID's. You can only have one per page.

The other option is to use our API and the message/share endpoint. This will give you more control. http://stocktwits.com/developers/docs/api#messages-create-docs