<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Viddler Developers &#187; development</title>
	<atom:link href="http://developers.viddler.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://developers.viddler.com</link>
	<description>Testing tomorrow's video platform, today.</description>
	<lastBuildDate>Wed, 09 Sep 2009 04:27:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to: Use the Viddler API with CodeIgniter</title>
		<link>http://developers.viddler.com/2009/08/04/codeigniter-phpviddler/</link>
		<comments>http://developers.viddler.com/2009/08/04/codeigniter-phpviddler/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 01:26:56 +0000</pubDate>
		<dc:creator>Colin Devroe</dc:creator>
				<category><![CDATA[phpViddler]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpviddleruploadify]]></category>
		<category><![CDATA[uploadify]]></category>
		<category><![CDATA[viddler api]]></category>

		<guid isPermaLink="false">http://developers.viddler.com/?p=422</guid>
		<description><![CDATA[The Viddler team is using CodeIgniter more and more for our internal PHP projects. Obviously we need to use CodeIgniter with the Viddler API quite a bit so we figured we&#8217;d share with you how easy it is to include PHPViddler, the open source PHP API wrapper class for the Viddler API, in your CodeIgniter [...]]]></description>
			<content:encoded><![CDATA[<p>The Viddler team is using <a href="http://codeigniter.com/">CodeIgniter</a> more and more for our internal PHP projects. Obviously we need to use CodeIgniter with <a href="http://developers.viddler.com/documentation/">the Viddler API</a> quite a bit so we figured we&#8217;d share with you how easy it is to include <a href="http://developers.viddler.com/projects/api-wrappers/phpviddler/">PHPViddler</a>, the open source PHP API wrapper class for the Viddler API, in your CodeIgniter application.</p>
<p>Here are the steps to follow:</p>
<ol>
<li>Download the latest copy of PHPViddler.</li>
<li>Extract PHPViddler into system/libraries/phpviddler/ in your CodeIgniter installation.</li>
<li>Load the PHPViddler library (as needed) like this:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Load PHP Viddler and setup</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'phpviddler/php5viddler'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$viddler</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">php5viddler</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">apiKey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'your_api_key_here'</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Use $viddler->function_name() after that.</li>
</ol>
<p>I&#8217;ve just set up a local CodeIgniter installation and had multi-file uploading working within about 30 minutes using PHP Viddler with <a href="http://developers.viddler.com/projects/api-wrappers/phpviddler/uploadify/">PHPViddlerUploadify</a> (an extension of both PHPViddler and the JavaScript framework <a href="http://jquery.com/">jQuery</a>) for easy file uploading.</p>
<p>We hope that you enjoy using <a href="http://developers.viddler.com/projects/api-wrappers/phpviddler/">PHPViddler</a> with <a href="http://codeigniter.com/">CodeIgniter</a> as much as we do.</p>
]]></content:encoded>
			<wfw:commentRss>http://developers.viddler.com/2009/08/04/codeigniter-phpviddler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with phpViddler Part 2: User authentication and sessions</title>
		<link>http://developers.viddler.com/2008/04/20/getting-started-with-phpviddler-part-2-user-authentication-and-sessions/</link>
		<comments>http://developers.viddler.com/2008/04/20/getting-started-with-phpviddler-part-2-user-authentication-and-sessions/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 22:49:38 +0000</pubDate>
		<dc:creator>Colin Devroe</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[phpViddler]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[viddler]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://lab.viddler.com/?p=16</guid>
		<description><![CDATA[If you haven&#8217;t already, please be sure to read part one that Kyle put together, which covers the simple task of initiating the phpViddler class and using it to list videos.  Some of the code found herein may not make sense if you haven&#8217;t read part one.
I think you&#8217;ll find, through these tutorials, that [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t already, please be sure to read part one that Kyle put together, which covers the simple task of <a href="http://lab.viddler.com/2008/04/20/phpviddler-part-1-listing-video/">initiating the phpViddler class and using it to list videos</a>.  Some of the code found herein may not make sense if you haven&#8217;t read part one.</p>
<p>I think you&#8217;ll find, through these tutorials, that using phpViddler makes it dead simple to use Viddler&#8217;s APIs.  Please leave feedback if you have any specific areas you&#8217;d like us to cover.</p>
<h3>Authenticating a user</h3>
<p>To authenticate a user you will need both the username and password of the user.  For this example, we&#8217;ll say the username is my username, <a href="http://www.viddler.com/explore/cdevroe/">cdevroe</a>, and the password will be a fake password of &#8216;password&#8217;.</p>
<p><span id="more-16"></span></p>
<p>There are a few important points to remember when authenticating a user using Viddler&#8217;s API, whether you use phpViddler or not.  Each time you authenticate a user you are giving a sessionID representing a &#8220;session&#8221; for <em>that username and password</em>.  If you are looking to log in a different user, you will need to re-authenticate the credentials to get another sessionID.</p>
<p>As we move forward with this series, you will learn more about where you use a sessionID to do things like changing meta data, uploading video, etcetera.</p>
<p>To start a new session, this is the code you will need to use once you have the username and password for the user.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Authenticate the user, return array of response</span>
<span style="color: #000088;">$sessionResponse</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_authenticate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cdevroe'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>By default, <a href="http://wiki.developers.viddler.com/index.php/Phpviddler">phpViddler</a> will return a multi-dimensional array of <a href="http://wiki.developers.viddler.com/index.php/Viddler.users.auth">the Viddler.users.auth</a> API method.</p>
<p><strong>Check for errors</strong> before you do anything.  Typical authentication errors are that the username does not exist (error code 101), or the password provided is incorrect (error code 103).</p>
<p>Once you&#8217;ve determined there are no errors, you can now put the sessionID into a variable for use later.  In our next parts, we&#8217;ll be using the sessionID in a number of ways.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Store sessionID in variable.</span>
<span style="color: #000088;">$sessionID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sessionResponse</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'auth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sessionid'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>Notes about sessions</h3>
<p>SessionIDs expire after 15 minutes of inactivity.  You should build your application with this in mind.  For example, if you build an uploading tool, and the upload of a video file takes longer than 15 minutes, the session you are using to upload a video with will expire before your upload is finished.  Don&#8217;t panic!  All you need to do is ask for a new one and you&#8217;re all set.</p>
<p>(Super side note: If you come to a point in your code where you need a sessionID, you can quickly run any method that requires a sessionID to see if the session is still valid, if it isn&#8217;t, get a new one, and continue your code.)</p>
<p>In our next part, we&#8217;ll be covering the use of our Record with Webcam API and uploading video files.</p>
<p>If you have any questions about authenticating users, or sessions in general, feel free to ask.</p>
]]></content:encoded>
			<wfw:commentRss>http://developers.viddler.com/2008/04/20/getting-started-with-phpviddler-part-2-user-authentication-and-sessions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting Started With phpViddler Part 1: Listing Videos</title>
		<link>http://developers.viddler.com/2008/04/20/phpviddler-part-1-listing-video/</link>
		<comments>http://developers.viddler.com/2008/04/20/phpviddler-part-1-listing-video/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 17:35:48 +0000</pubDate>
		<dc:creator>Kyle Slattery</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[phpViddler]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[viddler]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://lab.viddler.com/?p=14</guid>
		<description><![CDATA[Over the next couple weeks, Colin and I are going to be guiding you through how to use Viddler's API with phpViddler, the PHP wrapper for our API functions.  We'll be covering everything from embedding videos to registering new users, so keep checking back!

Today, I'll be covering how to list videos using the Viddler API and phpViddler using the functions <code>videos_listbyuser</code>, <code>videos_listbytag</code>, and <code>videos_listfeatured</code>.
]]></description>
			<content:encoded><![CDATA[<p>Over the next couple weeks, Colin and I are going to be guiding you through how to use Viddler&#8217;s API with phpViddler, the PHP wrapper for our API functions.  We&#8217;ll be covering everything from embedding videos to registering new users, so keep checking back!</p>
<p>Today, I&#8217;ll be covering how to list videos using the Viddler API and phpViddler using the functions <span class="code">videos_listbyuser</span>, <span class="code">videos_listbytag</span>, and <span class="code">videos_listfeatured</span>.<br />
<span id="more-14"></span></p>
<h3>Getting Set up</h3>
<p>To start using the Viddler API, you&#8217;ll need to get an API key, which you can get by filling out <a href="http://lab.viddler.com/getting-started/request-key/">this form</a>.  Once you&#8217;ve received your API key, go ahead and <a href="http://wiki.developers.viddler.com/index.php/Phpviddler">download phpViddler from our wiki</a>.  Now onto the actual code.  To get phpViddler going, you&#8217;re going to need to add the following to your script:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'phpviddler.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$viddler</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Phpviddler<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">apiKey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR API KEY'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>So what happened here?  We included the &#8216;phpviddler.php&#8217; file, which houses the Phpviddler class.  Next, we created a new instance of the <code>Phpviddler</code> class called <code>$viddler</code>, and then finally we set the API key for phpViddler to use.</p>
<h3>Getting A User&#8217;s Videos</h3>
<p>One of the first things you&#8217;ll likely want to do is get videos by a specific user.  To accomplish this, we&#8217;ll be using the <code>videos_listbyuser()</code> function, which calls the <a href="http://wiki.developers.viddler.com/index.php/Viddler.videos.getByUser">viddler.videos.getByUser API method</a>.  We&#8217;ll then want to display each video using <code>video_getEmbed()</code>.  Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$videos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videos_listbyuser</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$videos</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$video</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmbed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$video</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Replace &#8220;username&#8221; with the username you&#8217;re looking up, the above code will retrieve and display all of their videos.  First, let&#8217;s go over what each line does.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$videos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>videos_listbyuser<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #666666; font-style: italic;">#x27;username&amp;#x27;);</span></pre></div></div>

<p>Here we&#8217;re just calling the <code>videos_listbyuser()</code> function and passing &#8220;username&#8221; as an argument.  If you look at the code for <code>videos_listbyuser()</code>, you&#8217;ll notice it actually takes 4 arguments: $user, $page, $per_page, and $sessionid.  We&#8217;ll ignore $sessionid for now, since we&#8217;ll be covering sessions in a later post.  $page and $per_page are used for limiting your results.  So, if you want to page through results and have 5 per page, you&#8217;d use the following call:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$videos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videos_listbyuser</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Just change $page to go to the next set of videos.  Now, onto handling what Phpviddler returns:</p>
<p>Whenever you make a call using phpViddler, you&#8217;ll get an array returned.  For instance, the above call, if you put in &#8220;winelibrarytv&#8221; for a user, you&#8217;ll get something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span>video_list attr<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span>total<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">456</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span>video_list<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span>video<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
                <span style="color: #009900;">&#40;</span>
                    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
                        <span style="color: #009900;">&#40;</span>
                            <span style="color: #009900;">&#91;</span>author<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> winelibrarytv
                            <span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> c866e246
                            <span style="color: #009900;">&#91;</span>title<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> episode445
                            <span style="color: #009900;">&#91;</span>length_seconds<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">860</span>
                            <span style="color: #009900;">&#91;</span>description<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> 
                            <span style="color: #009900;">&#91;</span>view_count<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1452</span>
                            <span style="color: #009900;">&#91;</span>upload_time<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1208384555000</span>
                            <span style="color: #009900;">&#91;</span>comment_count<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span>
                            <span style="color: #009900;">&#91;</span>url<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.viddler.com/explore/winelibrarytv/videos/522/</span>
                            <span style="color: #009900;">&#91;</span>thumbnail_url<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//cdn-ll-46.viddler.com/e2/thumbnail_2_c866e246.jpg</span>
                        <span style="color: #009900;">&#41;</span>
&nbsp;
                    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
                        <span style="color: #009900;">&#40;</span>
                            <span style="color: #009900;">&#91;</span>author<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> winelibrarytv
                            <span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> add5b980
                            <span style="color: #009900;">&#91;</span>title<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> episode444
                            <span style="color: #009900;">&#91;</span>length_seconds<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1090</span>
                            <span style="color: #009900;">&#91;</span>description<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> 
                            <span style="color: #009900;">&#91;</span>view_count<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">17216</span>
                            <span style="color: #009900;">&#91;</span>upload_time<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1208288599000</span>
                            <span style="color: #009900;">&#91;</span>comment_count<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span>
                            <span style="color: #009900;">&#91;</span>url<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.viddler.com/explore/winelibrarytv/videos/520/</span>
                            <span style="color: #009900;">&#91;</span>thumbnail_url<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//cdn-ll-80.viddler.com/e2/thumbnail_2_add5b980.jpg</span>
                        <span style="color: #009900;">&#41;</span>
&nbsp;
                <span style="color: #009900;">&#41;</span>
&nbsp;
        <span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#41;</span></pre></div></div>

<p>So, to iterate through the videos, you just need to use a foreach loop with the $videos['video_list']['video'] array:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$videos</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$video</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmbed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$video</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Passing the video id to $viddler-&gt;getEmbed() returns the proper embed code for the video.</p>
<h3>Other Video List Functions</h3>
<p>There are a couple other functions in phpViddler which behave similar to <code>videos_listbyuser()</code>: <code>videos_listbytag()</code> and <code>videos_listfeatured()</code>.</p>
<h4>videos_listbytag($tag, $page, $per_page)</h4>
<p>This function utilizes the <a href="http://wiki.developers.viddler.com/index.php/Viddler.videos.getByTag">Viddler.videos.getByTag API call</a> and can take 3 arguments, $tag, $page, and $per_page.  $tag refers to the tag you&#8217;re searching by, and $page and $per_page behave the same as before.  Here&#8217;s how you would use it to get all videos tagged with &#8220;metoday&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$videos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videos_listbytag</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'metoday'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$videos</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$video</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmbed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$video</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h4>videos_listfeatured()</h4>
<p>Using this function enables you to get all the videos featured on the <a href="http://blog.viddler.com">main Viddler Blog</a> and uses the <a href="http://wiki.developers.viddler.com/index.php/Viddler.videos.getFeatured">Viddler.videos.getFeatured API call</a>.  It doesn&#8217;t require any arguments, so you would just use it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$videos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videos_listfeatured</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$videos</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'video'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$video</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$viddler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmbed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$video</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>More to come</h3>
<p>And, with that, we&#8217;ve finished our look at how to list videos with phpViddler.  Over the next couple of weeks, we&#8217;ll be posting more tutorials, so make sure to <a href="http://lab.viddler.com/feed/">subscribe to our RSS feed</a> and keep checking back!  Also, if you ever have any questions, you can either leave a comment on the blog, or start a new thread in the <a href="http://www.viddler.com/groups/developers/">Developers group</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://developers.viddler.com/2008/04/20/phpviddler-part-1-listing-video/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
