EmbedTweet
Questions answered by this recipe
How can I display a specific tweet in my page?
Description
Enter your recipe's description here. EmbedTweet provides a short form markup that permits users to pull in a specific tweet specified by the twitter status id and format it as it appears in twitter.
Installation
To install this recipe, download embedtweet.phpΔ and copy it into your wiki's cookbook directory.
Configuration
Add the following lines to your local/config.php
file:
$EnableEmbedTweet=true; include_once("$FarmD/cookbook/embedtweet.php");
Usage
To use, simply include the following in your wiki page text:
[tweet id=<status id of tweet>]
Alternately, you can use the URL of the particular status:
[tweet url=https://twitter.com/<user>/status/<status code>]
Both of these can be obtained for a tweet on the twitter web site by clicking on the "Expand" link in the tweet, then on "Embed this Tweet" and selecting Link tab. The status id is the last string of digits in the path. If you choose to url method, use the entire link shown.
Additional parameters
Additional parameters are described on the API document at https://dev.twitter.com/docs/api/1/get/statuses/oembed but note that the omit_script parameter is always set to true and the script is linked in the html footer automatically by the recipe.
Notes
For future-proofing, there are two customizable variables that deal with the functionality provided by twitter.
$ETweet_API_URL
- is the url of API call that returns the contents of the tweet desired.
$ETweet_Widget_Script
- is the HTML that will include the widget script from twitter in the page footer.
Neither of these should be set or changed unless the twitter API changes.
TODO:
- Provide a means of saving the tweet instead of fetching it each time. This will also prevent losing the tweet in the case it disappears from twitter, or twitter is inaccessible for some reason.
NOTE:
- Some twitter feeds are inaccessible by outside sources, unless the caller is an authenticated user, and is allowed to view the tweet. Currently, there is nothing in twitter's oembed API that can get around this.
Git Repository
The recipe is maintained at the following Gitorious repository: https://gitorious.org/pmwikistuff/embedtweet
Change log / Release notes
See also
Contributors
Comments
See discussion at EmbedTweet-Talk
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.