TXP Plugins
arc_recent_youtube :: Dec 9, 12:41 PM
This plugin retrieves recent videos from the popular Youtube website and embeds them into your website. Recent videos from a user’s uploads or favourites, or with a given tag/keyword can be simply retrieved; alternatively you can specify a Youtube feed url. The Youtube player’s appearance can also be customised as with the arc_youtube plugin.
arc_recent_youtube uses SimplePie 1.0 b3.2 for feed retrieval and must be uploaded to your Textpattern install. The relevant SimplePie files are included in the download file.
Installation
- Upload ‘simplepie.inc’ and ‘npdata.ser’ to any readable directory on your web server. By default arc_recent_youtube will look for these in /[path_to_txp]/lib/, if you upload them elsewhere you must specify this using the ‘simplepie’ attribute in the plugin tag.
- To install arc_recent_youtube go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin.
Syntax
<txp:arc_recent_youtube feed=“http://gdata.youtube.com/feeds/base/standardfeeds/GB/most_recent” />
<txp:arc_recent_youtube user=“bbc” />
<txp:arc_recent_youtube tag=“cartoon” />
Usage
The feed
Define the Youtube feed you want to retrieve recent videos from using one of the following attributes (in order of priority):-
- feed – url of the Youtube feed (Youtube RSS feeds)
- user – Youtube username to retrieve recent uploaded videos from
- fav – Youtube username to retrieve recent favourite videos from
- tag – retrieve recent Youtube videos posted with a given tag
Only one feed is retrieved, however, if you assign more than one of the above attributes then the one with highest priority overrides the others.
Basics
| Attribute | Description | Default | Example |
|---|---|---|---|
| limit | Maximum number of videos to return | 5 | limit=“1” |
| vplayer1 | ‘1’ to show video, ‘0’ to hide | 1 | vplayer=“0” |
| vlabel | ‘1’ to show video titles, ‘0’ to turn off | 1 | vlabel=“0” |
| vlabeltag | Wraptag for video titles | h4 | vlabeltag=“p” |
| link | Set to ‘1’ to link video titles to the Youtube video page | 1 | link=“1” |
| label | Label for the top of the list | no label | label=“My Youtube favourites” |
| labeltag | Independent wraptag for label | unset | labeltag=“h3” |
| break | HTML tag (without brackets), or string, used to separate the videos | br | break=“li” |
| wraptag | HTML tag to be used as the wraptag, without brackets | unset | wraptag=“div” |
| class | CSS class attribute for wraptag | arc_recent_youtube | class=“youtube” |
1 Turning off the video using vplayer enables you to return just a linked list of video titles.
Customising the Youtube player
You can customise the appearance of the Youtube flash player using this plugin to define colours, size, and language settings like with the arc_youtube plugin.
| Attribute | Description | Default | Example |
|---|---|---|---|
| width | Width of video | 425 | width=“200” |
| height | Height of video | 344 | height=“150” |
| color1 | Six-digit hexadecimal colour code (if color1 and color2 are unset then the default Youtube colour scheme is used) | unset | color1=“2b405b” |
| color2 | Six-digit hexadecimal colour code | unset | color2=“6b8ab6” |
| border | ‘1’ to show border, ‘0’ to hide border | 0 | border=“1” |
| fs | ‘1’ to allow full screen, ‘0’ to disable full screen mode | 1 | |
| lang | Language code for player, by default this is set to English “en” | en | lang=“fr” |
SimplePie setup
| Attribute | Description | Default | Example |
|---|---|---|---|
| caching | ‘1’ to cache feed, ‘0’ to turn caching off | 1 | caching=“0” |
| cache_dir | Absolute path to the SimplePie cache directory (must be writable) | ||
| cache_time | Time in minutes that the cache files are stored before being refreshed | 60 | cache_time=1440 |
| simplepie | Absolute path to the SimplePie class file | /[path_to_txp]/lib/ | simplepie=”/classes/” |
If you have installed the SimplePie class file somewhere other than the textpattern/lib/ directory then you need to specify the absolute path using the simplepie attribute.
Examples
Example 1: Recent uploads from Youtube user ‘bbc’
<txp:arc_recent_youtube user=“bbc” />
Example 2: Latest upload from user ‘bbc’ with blue coloured player
<txp:arc_recent_youtube user=“bbc” color1=“006699” color2=“54abd6” limit=“1” />
This just outputs the most recent upload from the user and modifies the appearance of the Flash player.
Example 3: No caching
<txp:arc_recent_youtube tag=“cartoon” caching=“0” />
This retrieves videos tagged as ‘cartoon’ without caching, every page load will retrieve the feed. This is not recommended.
Plugin details
Initial release: 9 December 2008
Current version: 0.1
[ download ]
Please feel free to leave your comments and questions about this plugin below. Alternatively you can post them on the forum thread.
Use of my plugins is free; however, if you would like to show your appreciation you can do so by clicking the 'Donate' button below and make a contribution to the Andy Carter's coding fund via PayPal...
Comment
Recent plugins
Textpattern links
Textpattern forums
Textpattern's support forums.
Textpattern Resources
A directory of plugins, tutorials, and other resources for and by the Textpattern community.
TXP Tips
Tips, tutorials, and code to help build better Textpattern websites.
We Love TXP
Design gallery of sites using Textpattern.