CodeCanyon

Youtube playlist jquery and php Gdata Api

How to set for example a username or playlist

$video = new youtubelist('username'); $video->set_username('Here the username);

and a playlist

$video = new youtubelist('playlist'); $video->set_playlist('Here the username);

How can I retreive more then 50 video’s

That is really simple

Just copy and paste the complete $video = new youtubelist(‘keywords’); (till the end of the foreach)

and set the following parameter to 51

$video->set_start(51);

Now there a 100 video’s

Installation in wordpress

First download thepluginIncludeme http://wordpress.org/extend/plugins/include-me/

and activate

As an example unzip all the files to a new map called youtube

Upload this map to the root of your wordpress installation

Open youtube/index.php and change the path settings to the css and js files Example: ect.

script type="text/javascript" src="youtube/js/jquery.youtubeplaylist-min.js"></script>

Also change <div class="youtubeplayer"> to <div id="youtubeplayer"> Change the cache path to $video->set_xmlpath(‘youtube/cache/’); Open youtube/css/youtubeplaylist.css and put for all the css values #youtubeplayer Now go to a post or page and insert the following code <code> [includeme file="youtube/index.php"]</code> That's it folks :-)</div></div>

Playlist not working

If you copy and paste a playlist url from youtube you will see something like this

http://www.youtube.com/playlist?list=PL337977837EFD386A

just remove the PL The PL is added by the youtube website and isn’t supported by the gdata API

so it will be

[youtube-list feed=”playlist” playlist=”337977837EFD386A”]

Clear the cache files

NB.

For myself I use an cache cleaner since I use the search option in my demo

Here the snippet

// Clear the cache of old xml searches
$xmlcaching   = "./cache/";
function cacheCleaner() {
    global $xmlcaching;
    $cacheLife = 86400; // Empty after one day 86400 (604800 1 week)
    $path = $xmlcaching;
    $handle = opendir($path);
    while ($file = readdir($handle)) {
      if ($file != '.' AND $file != '..' AND preg_match('/(.*)\.xml/i',$file)) {
        if (time()-fileatime($path.$file)>$cacheLife)
            unlink($path.$file);
    }
  }
}
cacheCleaner();

You can place this snippet in your index.php

by
by
by
by
by