<?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>Okada Design Blog &#187; zend</title>
	<atom:link href="http://www.okadadesign.no/blog/tag/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.okadadesign.no/blog</link>
	<description>Welcome to Okada Design Web Development Blog</description>
	<lastBuildDate>Wed, 11 Jan 2012 23:21:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Zend framework Flickr class on Codeignier with jquery</title>
		<link>http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/</link>
		<comments>http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 09:17:59 +0000</pubDate>
		<dc:creator>shinokada</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.okadadesign.no/blog/?p=478</guid>
		<description><![CDATA[ <p> This file does not contain CI core and Zend framework. You can download the previous files and add to it.</p> <p>This is an extension of using Zend_Service_Flickr from this post.</p> <p></p> Download Files <p>The previous post has a very plain display, so this time I added minimum style and used jquery tools [...]
Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fzend-framework%2Fzend-framework-flickr-class-on-codeignier-with-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fzend-framework%2Fzend-framework-flickr-class-on-codeignier-with-jquery%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft size-full wp-image-479" title="zend_flickr1" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/zend_flickr1.jpg" alt="zend_flickr1" width="460" height="235" /><br />
This file does not contain CI core and Zend framework.<br />
You can <a href="http://www.box.net/shared/0cxtrq8apq">download the previous files</a> and add to it.</p>
<p>This is <a href="http://www.okadadesign.no/blog/?p=410">an extension of using Zend_Service_Flickr from this post.</a></p>
<div class="clearboth"></div>
<p><span id="more-478"></span></p>
<h4 class="download"><a href="http://www.box.net/shared/boomus355i">Download Files</a></h4>
<p>The previous post has a very plain display, so this time I added minimum style and used <a href="http://flowplayer.org/tools/demos/scrollable/plugins/index.html">jquery tools scrollable </a>for slide effects.</p>
<h3>Goals</h3>
<p>Index page has a form with search word and number of image input field.</p>
<p>If a visitor did not enter any search word, then a warning message &#8220;All fields are required . Please try again!&#8221; will be displayed.</p>
<p>If only a search word is input, then 20 images will be displayed and message will tell the item searched and number of images.</p>
<p>The default image will be fish and number of image will be 20.</p>
<div class="clearboth"></div>
<p><!--more--></p>
<h3>Set up</h3>
<p>I created a folder called ci_zend_flickr in c:\xampp\htdocs\.</p>
<p><strong>Note for Mac user: </strong>Please open application/helpers/zend_framework_helper.php and comment out Windows part and uncomment the other part.</p>
<p>If you don&#8217;t have this file, you need to <a href="http://www.box.net/shared/0cxtrq8apq">download the file from the previous post here</a>.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
// For Windows
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.str_replace(&quot;/&quot;, &quot;\\&quot;, BASEPATH).&quot;contrib\\&quot;);
require_once ('Zend/Loader.php');

// For Non-Windows
/*
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.BASEPATH.&quot;/contrib/&quot;);
require_once 'Zend/Loader.php';
*/

?&gt;
</pre>
<h3>Zend Framework</h3>
<p><a href="http://www.okadadesign.no/blog/?p=410">Please follow this post</a> to set up Zend framework on Codeigniter or <a href="http://www.box.net/shared/0cxtrq8apq">download the file from the previous post here</a></p>
<h3>Config</h3>
<h4>system/application/config/autoload.php</h4>
<p>Autoload Zend Framework.</p>
<pre class="brush: php; title: ; notranslate">
$autoload['helper'] = array('zend_framework');
</pre>
<h4>system/application/config/config.php</h4>
<p>Change your base_url to suit your structure.<br />
Add your Flickr API key here. <a href="http://www.flickr.com/services/api/misc.api_keys.html">The details of Flickr API key is here.</a></p>
<pre class="brush: php; title: ; notranslate">
$config['base_url']	= &quot;http://127.0.0.1/ci_zend_flickr/&quot;;
...
...
$config['flickr_api_key'] = 'your api key here';
</pre>
<h3>Controller</h3>
<h4>system/application/controllers/flickr3.php</h4>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class Flickr3 extends Controller{
    protected $flickrapikey;
    protected $flickemail='youremail here';

    function __construct() {

        parent::Controller();
        $this-&gt;flickrapikey = $this-&gt;config-&gt;item('flickr_api_key');
        Zend_Loader::loadClass('Zend_Service_Flickr');
        $this-&gt;load-&gt;helper(array('form', 'url'));
	$this-&gt;load-&gt;library('form_validation','session');

    }

    function index()
    {
    $flickr = new Zend_Service_Flickr($this-&gt;flickrapikey);
    $query =array(&quot;fish&quot;);
    $options = array(
        'tag_mode' =&gt; 'or',
        'per_page' =&gt; 20
        );
    $results = $flickr-&gt;tagSearch($query,$options);
   $message =&quot;&quot;;
   $data['message']=$message;
    $data['results']=$results;
    $data['word']=$query;
    $data['imgnum']= 20;
    $data['title']='ZF on CI: Flickr';
    $data['main']='flickr_view3';
    $this-&gt;load-&gt;view('template', $data);
    }

    function flickrsearch()
    {
    $flickr = new Zend_Service_Flickr($this-&gt;flickrapikey);
    $perpage = $this-&gt;input-&gt;post('search');
    $imgnum = $this-&gt;input-&gt;post('imgnum');
    $this-&gt;form_validation-&gt;set_rules('search', 'Search', 'required');
    $this-&gt;form_validation-&gt;set_rules('imgnum', 'Images', 'is_natural');

    	if ($this-&gt;form_validation-&gt;run() == FALSE)
		{
		     $this-&gt;session-&gt;set_flashdata('index_msg', 'All fields are required . Please try again!');
		    redirect('flickr3/index');

		}
		else
		{
		$query =array($perpage);

                if (!is_numeric($imgnum)){
                $imgnum = 20;}

               $options = array(
               'per_page' =&gt; $imgnum
                );
               $results = $flickr-&gt;tagSearch($query,$options);
               $data['results']=$results;
               $data['title']='ZF on CI: Flickr';
               $data['main']='flickr_view3';
               $message =&quot;You are searching for \&quot;&quot;.$perpage. &quot;\&quot;&lt;br /&gt;You are searching for &quot;. $imgnum . &quot; images&quot;;
               $data['message']= $message;
               $this-&gt;load-&gt;view('template', $data);
		}
         }
}
?&gt;
</pre>
<p>The constructor loads the Flickr API key, Zend framework, necessary helpers and libraries.<br />
This time I am using form helper which will be used in a view file, and form_validation which will be used in this controller and session. I am using session for CI&#8217;s flashdata.</p>
<p>In index class, create a new object of Zend_Service_Flickr with the Flickr API key as a parameter.<br />
Set a variable $query to fish. You can change it as you like. This will be needed for loading a website first time.<br />
Tag mode and number of images options are added. If you open Zend/Service/Flickr.php or <a href="http://framework.zend.com/svn/framework/standard/tags/release-1.9.6/library/Zend/Service/Flickr.php">see here</a>, you will see different options which can be set.</p>
<p>A variable message is set. This will be needed later to display the search details.<br />
Then all other data are stored.<br />
I am loading view/template. In this template, it has a $main variable and flickr_view3 is set to it as well.</p>
<pre class="brush: php; title: ; notranslate">
$data['main']='flickr_view3';
$this-&gt;load-&gt;view('template', $data);
</pre>
<p>A method flickrsearch will take inputs from the form. Search and imgnum will be stored to their variables, and <a href="http://codeigniter.com/user_guide/libraries/form_validation.html">form_validation rules</a> are set.</p>
<p>If this form validation gives a false, then flashdata is set to index_msg, and redired to index.<br />
Otherwise a query will be set. In case if number is not set, 20 is set as default here as well.</p>
<p>When it is successful, a message valiable $message is set and inform the word and number of image searched.</p>
<h3>Views</h3>
<h4>system/application/views/template.php</h4>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
  &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
  &lt;base href=&quot;&lt;?=base_url();?&gt;&quot;&gt;

&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;?=base_url();?&gt;css/default.css&quot; /&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://static.flowplayer.org/tools/css/scrollable-horizontal.css&quot; /&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://static.flowplayer.org/tools/css/scrollable-buttons.css&quot; /&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://static.flowplayer.org/tools/css/scrollable-navigator.css&quot; /&gt;
&lt;!-- Full version of jQuery Tools + jQuery 1.3.2 --&gt;
	&lt;script src=&quot;http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js&quot;&gt;&lt;/script&gt;
        &lt;script&gt;
// What is $(document).ready ? See: http://flowplayer.org/tools/using.html#document_ready
$(document).ready(function() {

// heeeeeeeeeeere we go.
$(&quot;#chained&quot;).scrollable({hoverClass: 'hover'}).circular().navigator().mousewheel().autoscroll({
	steps: 1,
	interval: 3000
});
});
&lt;/script&gt;
&lt;style&gt;
.scrollable img {
	width:100px;
	margin:20px 5px 20px 21px;
}

.scrollable img.hover {
	background-color:#123;
}
&lt;/style&gt;

&lt;noscript&gt;
Javascript is not enabled! Please turn on Javascript to use this site.
&lt;/noscript&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapper&quot;&gt;
  &lt;div id=&quot;header&quot;&gt;
  &lt;?php $this-&gt;load-&gt;view('header');?&gt;
  &lt;/div&gt;

  &lt;div id=&quot;nav&quot;&gt;
  &lt;?php $this-&gt;load-&gt;view('navigation');?&gt;
  &lt;/div&gt;

  &lt;div id=&quot;main&quot;&gt;
  &lt;?php $this-&gt;load-&gt;view($main);?&gt;
  &lt;/div&gt;

  &lt;div id=&quot;footer&quot;&gt;
  &lt;?php $this-&gt;load-&gt;view('footer');?&gt;
  &lt;/div&gt;

&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>All the necessary style sheets and jquery tools are added in the head section. You can find <a href="http://flowplayer.org/tools/demos/scrollable/plugins/index.html">details of different set ups here.</a></p>
<p><strong>Note: </strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $this-&gt;load-&gt;view('header');?&gt;
</pre>
<p>This code will load header.php in the views folder.</p>
<h4>Other view php</h4>
<ol>
<li>system/application/views/header.php</li>
<li>system/application/views/navigation.php</li>
<li> system/application/views/footer.php</li>
</ol>
<p>These files have nothing at the moment. But you are free to add any codes.</p>
<h4>system/application/views/flickr_view3.php</h4>
<pre class="brush: php; title: ; notranslate">
&lt;h1&gt;Zend Framework on Codeigniter: Flickr&lt;/h1&gt;
&lt;div id=&quot;search&quot;&gt;
&lt;?

if ($this-&gt;session-&gt;flashdata('index_msg')){
	echo &quot;&lt;div class='flashmessage'&gt;&quot;;
	echo $this-&gt;session-&gt;flashdata('index_msg');
	echo &quot;&lt;/div&gt;&quot;;
}
if ($message){
  echo &quot;&lt;div class='message'&gt;&quot;;
	echo $message;
	echo &quot;&lt;/div&gt;&quot;;
}
echo form_open('flickr3/flickrsearch');

$data = array(
              'name'        =&gt; 'search',
              'id'          =&gt; 'search',
              'value'       =&gt; '',
              'maxlength'   =&gt; '100',
              'size'        =&gt; '50',
            );
echo &quot;\n&lt;h3&gt;Enter search words&lt;/h3&gt;\n&quot;;
echo form_input($data).&quot;\n&quot;;
echo &quot;&lt;br /&gt;\n&lt;h3&gt;Enter number of images&lt;/h3&gt;\n&quot;;
$data = array(
              'name'        =&gt; 'imgnum',
              'id'          =&gt; 'imgnum',
              'value'       =&gt; '',
              'maxlength'   =&gt; '20',
              'size'        =&gt; '30',
            );
echo form_input($data).&quot;\n&quot;;
echo form_submit('submit', 'Submit').&quot;\n&quot;;

echo form_close().&quot;\n&quot;;
?&gt;

&lt;/div&gt;

&lt;!-- wrapper for navigator elements --&gt;
&lt;div class=&quot;navi&quot;&gt;&lt;/div&gt;

&lt;!-- &quot;previous page&quot; action --&gt;
&lt;a class=&quot;prevPage browse left&quot;&gt;&lt;/a&gt;

&lt;!-- root element for scrollable --&gt;
&lt;div class=&quot;scrollable&quot; id=&quot;chained&quot;&gt;

	&lt;!-- root element for the items --&gt;
	&lt;div class=&quot;items&quot;&gt;

&lt;?php
            foreach ($results as $result)
            {
            echo '&lt;img src=&quot;'.$result-&gt;Thumbnail-&gt;uri.'&quot; /&gt;'.&quot;\n&quot;;
            }

?&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;!-- &quot;next page&quot; action --&gt;
&lt;a class=&quot;nextPage browse right&quot;&gt;&lt;/a&gt;
&lt;br clear=&quot;all&quot; /&gt;
</pre>
<p>Divs for flashdata and message are added at the beginning. Since we loaded the <a href="http://codeigniter.com/user_guide/helpers/form_helper.html">form helper</a> in our controller, form_open and other function are used for this form.</p>
<p>For example</p>
<pre class="brush: php; title: ; notranslate">
echo form_open('flickr3/flickrsearch');
</pre>
<p>This will output the following html.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;http://127.0.0.1/ci_zend_flickr/index.php/flickr3/flickrsearch&quot; method=&quot;post&quot;&gt;
</pre>
<p>From <a class="prevPage browse left"></a>, they are for jquery tools scrollable.</p>
<p>foreach function is used to show all the images.</p>
<p>If you wish to display other properties, please see <a href="http://framework.zend.com/manual/en/zend.service.flickr.html">Zend framework manual here.</a></p>
<h3>CSS style sheets</h3>
<p>The minimum style is added.</p>
<pre class="brush: css; title: ; notranslate">
body {
	background-color: #AFAFAF;

}

#wrapper {
	width: 780px;
	margin: auto;
	background-color: #fff;
	padding: 15px 30px;
}

h1 {
	font-size:28px;
	color:#333;

}

h2 {
	font-size:24px;
	color:#333;

}
p {
	font-size: 18px;

}
#main {

	margin-bottom: 100px;
}

#search {

	margin: 0;

}
.flashmessage {
	font-size: 20px;
	color: red;
}

.message {

	color: blue;
	font-size: 20px;
}
</pre>
<p>You can find all other style sheets for the scrollable in CSS folder. Please download the source.</p>
<h3>Test Drive</h3>
<p>Now you go to http://127.0.0.1/ci_zend_flickr/index.php/.<br />
Type in any word and number and click Submit.</p>
<p><img class="alignleft size-full wp-image-494" title="zend_flickr3" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/zend_flickr31.jpg" alt="zend_flickr3" width="460" height="267" /></p>
<p>Type in any word and no numbers. It will show 20 images.</p>
<p>Type no word or numbers and click Submit. It will show a warning.</p>
<p><img class="alignleft size-full wp-image-491" title="zend_flickr2" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/zend_flickr2.jpg" alt="zend_flickr2" width="460" height="164" /></p>
<p>You can type more than one words, i.e. dog, cat, cow.</p>
<p><img class="alignleft size-full wp-image-492" title="zend_flickr4" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/zend_flickr4.jpg" alt="zend_flickr4" width="460" height="257" /></p>
<div class="clearboth"></div>
<h3>Conclusion</h3>
<p>It looks better than the first trial. However a big problem lies in loading speed.<br />
It takes too much time to fetch images from Flickr and load to a page.<br />
Any suggestion on this point will be appreciate it.</p>
<p>Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Zend Framework on Codeigniter: Youtube</title>
		<link>http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/</link>
		<comments>http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 22:28:47 +0000</pubDate>
		<dc:creator>shinokada</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[XAMPP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[youtube]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.okadadesign.no/blog/?p=452</guid>
		<description><![CDATA[ <p> This post is about how to use Zend Framework on Codeigniter to show Youtube videos. </p> Download Note: <p>The download file is set up for Windows. If you are not using Windows, then open application/helpers/zend_framework_helper.php and comment out Windows part and uncomment the other part.</p> &#60;?php // For Windows ini_set(&#34;include_path&#34;, ini_get(&#34;include_path&#34;).PATH_SEPARATOR.str_replace(&#34;/&#34;, &#34;\\&#34;, [...]
Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fzend-framework-on-codeigniter-youtube%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fzend-framework-on-codeigniter-youtube%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft size-full wp-image-466" title="youtube3" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/youtube3.jpg" alt="youtube3" width="420" height="413" /><br />
This post is about how to use Zend Framework on Codeigniter to show Youtube videos.<br />
<span id="more-452"></span></p>
<div class="clearboth"></div>
<h4 class="download"><a href="http://www.box.net/shared/0cxtrq8apq">Download</a></h4>
<h5>Note:</h5>
<p>The download file is set up for Windows. If you are not using Windows, then open application/helpers/zend_framework_helper.php and comment out Windows part and uncomment the other part.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
// For Windows
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.str_replace(&quot;/&quot;, &quot;\\&quot;, BASEPATH).&quot;contrib\\&quot;);
require_once ('Zend/Loader.php');

// For Non-Windows
/*
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.BASEPATH.&quot;/contrib/&quot;);
require_once 'Zend/Loader.php';
*/

?&gt;
</pre>
<h3>Implement Zend Framework in Codeigniter</h3>
<p>First you have to implement Zend Framework in Codeigniter. <a href="http://www.okadadesign.no/blog/?p=410">Please read this post</a>.</p>
<h3>Controller/youtube2.php</h3>
<p>Create a file and add the following code.<br />
<!--more--></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Youtube2 extends Controller{
    protected $_youTube;

function __construct() {
    parent::Controller();
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    $this-&gt;_youTube = new Zend_Gdata_YouTube;
    }

function index(){
      // Gets playlists
    $data['playlistfeed']= $this-&gt;_youTube-&gt;getPlaylistListFeed('NationalGeographic');
    $this-&gt;load-&gt;view ('youtube_view2',$data);
    }

public function listAction(){
    // Gets playlist videos
    $playlistId = $this-&gt;uri-&gt;segment(4);
    $query = $this-&gt;_youTube-&gt;newVideoQuery(
    'http://gdata.youtube.com/feeds/playlists/' . $playlistId);
    $data['videoFeed']= $this-&gt;_youTube-&gt;getVideoFeed($query);
    $this-&gt;load-&gt;view('listaction_view', $data);
    }

public function viewAction(){
    // Gets video
    $videoId = $this-&gt;uri-&gt;segment(4);
    $data['videoId'] = $this-&gt;uri-&gt;segment(4);
    $data['videoEntry'] = $this-&gt;_youTube-&gt;getVideoEntry($videoId);
    $this-&gt;load-&gt;view('youtube_video_view', $data);
    }
}
</pre>
<p>Firstly I am adding a protected variable $_youTube.<br />
In the constructor, I load the class Zend_Gdata_Youtube, and create a new object.</p>
<p>In the function index, I add a variable playlistfeed and send it to a view called youtube_view2 which I am going to create it shortly.</p>
<p>I am going to collect National geographic videos in this case. You can change it as you wish.</p>
<h3>views/youtube_view2.php</h3>
<p>Create a file and add the following code.</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
  &lt;title&gt;Video lists&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;National Geographic Videos on Youtube&lt;/h1&gt;
&lt;dl&gt;
&lt;?php foreach ($playlistfeed as $playlistEntry): &gt;
&lt;?php $id = substr(strrchr(
$playlistEntry-&gt;getPlaylistVideoFeedUrl(), '/'
), 1); &gt;
&lt;dt&gt;
&lt;a href=&quot;youtube2/listAction/id/&lt;?php echo $id; &gt;/&quot;&gt;
&lt;?php echo $playlistEntry-&gt;title-&gt;text; &gt;
&lt;/a&gt;
&lt;/dt&gt;
&lt;dd&gt;&lt;?php echo $playlistEntry-&gt;description-&gt;text; &gt;&lt;/dd&gt;
&lt;?php endforeach; &gt;
&lt;/dl&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This will output the following html.</p>
<pre class="brush: xml; title: ; notranslate">
...
&lt;h1&gt;National Geographic Videos on Youtube&lt;/h1&gt;
&lt;dl&gt;
&lt;dt&gt;
&lt;a href=&quot;youtube2/listAction/id/746AD498C993B957/&quot;&gt;
Oceans&lt;/a&gt;

&lt;/dt&gt;
&lt;dd&gt;Explore the beauty of the world's oceans.&lt;/dd&gt;
&lt;dt&gt;
&lt;a href=&quot;youtube2/listAction/id/355D512277EFFA06/&quot;&gt;
Animal Attack!&lt;/a&gt;
&lt;/dt&gt;
...
...
</pre>
<p>When you click a link, it will take you listAction() function in youtube2 class and the fourth segment will be used as id in that class.<br />
<img class="alignleft size-full wp-image-464" title="youtube1" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/youtube1.jpg" alt="youtube1" width="420" height="374" /></p>
<div class="clearboth"></div>
<h3>views/listaction_view.php</h3>
<p>Create a file and add the following code.</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
  &lt;title&gt;Youtube Video Details&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;National Geographic Videos on Youtube. Videos about &lt;?php echo $videoFeed-&gt;title-&gt;text; &gt;&lt;/h1&gt;
&lt;dl&gt;
&lt;?php foreach ($videoFeed as $videoEntry): &gt;
&lt;?php $id = substr(strrchr($videoEntry-&gt;getFlashPlayerUrl(), '/'),
1); &gt;

&lt;dt&gt;
    &lt;h2&gt;
        &lt;?php echo &quot;Video Title: &quot;. $videoEntry-&gt;mediaGroup-&gt;title-&gt;text; &gt;

&lt;/h2&gt;
   &lt;h3&gt; &lt;?php echo anchor(&quot;youtube2/viewAction/id/$id/&quot;,&quot;Watch Video&quot;);&gt;
&lt;/h3&gt;

&lt;/dt&gt;
&lt;dd&gt;&lt;?php echo $videoEntry-&gt;mediaGroup-&gt;description-&gt;text. &quot;&lt;br /&gt;&lt;br /&gt;&quot;; &gt;
&lt;b&gt;&lt;?php echo &quot;Video id: &quot;. $id; &gt;
&lt;/b&gt;
&lt;/dd&gt;
&lt;?php endforeach; &gt;
&lt;/dl&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This listAction() function outputs the following html.</p>
<pre class="brush: xml; title: ; notranslate">
...
&lt;h1&gt;National Geographic Videos on Youtube. Videos about Oceans&lt;/h1&gt;
&lt;dl&gt;

&lt;dt&gt;
    &lt;h2&gt;
        Video Title: Feeding Frenzy: Manta Rays in the Maldives
&lt;/h2&gt;
   &lt;h3&gt; &lt;a href=&quot;http://127.0.0.1/ci_zend/index.php/youtube2/viewAction/id/yihoIvUBDM4?f=playlists&amp;amp;amp;app=youtube_gdata&quot;&gt;Watch Video&lt;/a&gt;&lt;/h3&gt;

&lt;/dt&gt;
&lt;dd&gt;When tide and current turn a tiny bay into a bowl of plankton, manta rays in the Maldives gather for a roiling, whirling feast.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Video id: yihoIvUBDM4?f=playlists&amp;amp;amp;app=youtube_gdata&lt;/b&gt;
&lt;/dd&gt;

&lt;dt&gt;
    &lt;h2&gt;
        Video Title: Penguins vs. Pelicans
&lt;/h2&gt;
   &lt;h3&gt; &lt;a href=&quot;http://127.0.0.1/ci_zend/index.php/youtube2/viewAction/id/Fhmm-A8wBzk?f=playlists&amp;amp;amp;app=youtube_gdata&quot;&gt;Watch Video&lt;/a&gt;&lt;/h3&gt;

&lt;/dt&gt;
...
...
</pre>
<p>The links will take you to youtube2 viewAction () function with Youtube video identifier.<br />
The viewAction() function will take the forth segment and show a video in the next step.</p>
<p><img class="alignleft size-full wp-image-465" title="youtube2" src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/youtube2.jpg" alt="youtube2" width="420" height="420" /></p>
<div class="clearboth"></div>
<h3>views/youtube_video_view.php</h3>
<p>Create a file and add the following code.</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
  &lt;title&gt;Watch: Youtube Videos&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;&lt;?php echo $videoEntry-&gt;mediaGroup-&gt;title-&gt;text; &gt;&lt;/h1&gt;
&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;
&lt;param name=&quot;movie&quot;
value=&quot;http://www.youtube.com/v/&lt;?php echo $videoId; &gt;&amp;amp;amp;rel=0&quot;&gt;
&lt;/param&gt;
&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;
&lt;embed src=&quot;http://www.youtube.com/v/&lt;?php echo $videoId; &gt;&amp;amp;amp;rel=0&quot;
type=&quot;application/x-shockwave-flash&quot;
wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;
&lt;/embed&gt;
&lt;/object&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This view outputs the following html.</p>
<pre class="brush: xml; title: ; notranslate">
...
&lt;h1&gt;Feeding Frenzy: Manta Rays in the Maldives&lt;/h1&gt;
&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;
&lt;param name=&quot;movie&quot;
value=&quot;http://www.youtube.com/v/yihoIvUBDM4&amp;amp;amp;rel=0&quot;&gt;
&lt;/param&gt;
&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;
&lt;embed src=&quot;http://www.youtube.com/v/yihoIvUBDM4&amp;amp;amp;rel=0&quot;
type=&quot;application/x-shockwave-flash&quot;
wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;
&lt;/embed&gt;
&lt;/object&gt;
...
...
</pre>
<p>Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to implement Zend Framework with Codeigniter</title>
		<link>http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/</link>
		<comments>http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 12:14:58 +0000</pubDate>
		<dc:creator>shinokada</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[XAMPP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.okadadesign.no/blog/?p=410</guid>
		<description><![CDATA[ Download Files <p>There are quite few posts how to use Zend framework in Codeigniter.</p> Beyond Coding Freakauth Phil&#8217;s post <p>However none of them worked on my XAMPP. I thought there might be some who are struggling to use Zend frame work on Windows. Here is how I did.</p> <p>Here you can read why [...]
Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fhow-to-implement-zend-framework-with-codeigniter-on-windows%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fhow-to-implement-zend-framework-with-codeigniter-on-windows%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h4 class="download">
<a href="http://www.box.net/shared/0cxtrq8apq">Download Files</a></h4>
<p>There are quite few posts how to use Zend framework in Codeigniter.</p>
<ol>
<li>
<a href="http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/">Beyond Coding</a>
</li>
<li><a href="http://freakauth.4webby.com/tutorials/using-zend-framework-components-in-code-igniter">Freakauth</a>
</li>
<li><a href="http://www.mynameisphil.net/article/may/2009/implementing-the-zend-framework-with-codeigniter/11">Phil&#8217;s post</a></li>
</ol>
<p>However none of them worked on my XAMPP. I thought there might be some who are struggling to use Zend frame work on Windows. Here is how I did.</p>
<p><a href="http://www.okadadesign.no/blog/?p=414">Here you can read</a> why they don&#8217;t work with Windows.</p>
<h3>Adding Zend Framework</h3>
<p><a href="http://www.mynameisphil.net/article/may/2009/implementing-the-zend-framework-with-codeigniter/11">Here you can read</a> how to add Zend Framework. And I use this structure for this post.</p>
<p>You need to create a folder ../system/contrib/ and add Zend folders in this folder.</p>
<pre>
<div class="codesnip-container" >../system/
         contrib/
               Zend/
                     Acl/
                     Acl.php
                     Amf/
                     Amf.php ...</div>
</pre>
<p>Create a file system/application/helpers/zend_framework_helper.php and add the following.<br />
<span id="more-410"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.str_replace(&quot;/&quot;, &quot;\\&quot;, BASEPATH).&quot;contrib\\&quot;);
require_once ('Zend/Loader.php');
?&gt;
</pre>
<p>If you are not using Windows, then add the following instead.</p>
<pre class="brush: php; title: ; notranslate">
ini_set(&quot;include_path&quot;, ini_get(&quot;include_path&quot;).PATH_SEPARATOR.BASEPATH.&quot;/contrib/&quot;);
require_once 'Zend/Loader.php';
</pre>
<h3>Adding it in autoload.php</h3>
<p>Open config/autoload.php and add the following.</p>
<pre class="brush: php; title: ; notranslate">
$autoload['helper'] = array('zend_framework');
</pre>
<h3>Using Zend in Codeigniter</h3>
<p>Now you can load any Zend class by adding Zend_Loader::loadClass(&#8216;ZEND-CLASS-HERE&#8217;);.<br />
You can see all the Zend classes here. <a href="http://framework.zend.com/manual/en/">http://framework.zend.com/manual/en/</a></p>
<p>Here are three examples.</p>
<h4>Zend_Service_Flickr</h4>
<p>Create a file controllers/flickr.php and add the following.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Flickr extends Controller
{
function __construct()
{
parent::Controller();

}

function index()
{

Zend_Loader::loadClass('Zend_Service_Flickr');

$flickr = new Zend_Service_Flickr('ADD-YOUR-KEY-HERE');
try
{

$results = $flickr-&gt;tagSearch(&quot;cat&quot;);
if ($results-&gt;totalResults() &gt; 0)
{

foreach ($results as $result)
{
echo '&lt;img src=&quot;'.$result-&gt;Square-&gt;uri.'&quot; /&gt;';
}

}
else
{
echo '&lt;p style=&quot;color: orange; font-weight: bold&quot;&gt;No Results Found.&lt;/p&gt;';
}
}
catch (Zend_Service_Exception $e)
{
echo '&lt;p style=&quot;color: red; font-weight: bold&quot;&gt;An error occured, please try again later. (' .$e-&gt;getMessage(). ')&lt;/p&gt;';
}

}
}

?&gt;
</pre>
<p>Don&#8217;t forget to change ADD-YOUR-KEY-HERE to your Flickr key.<br />
If you don&#8217;t have one, <a href="http://www.flickr.com/services/api/misc.api_keys.html">get it from here</a>.<br />
Then visit your controller, http://127.0.0.1/codeigniter/index.php/flickr to see the result.</p>
<h4>Using Zend_Gdata_YouTube</h4>
<p>Create another file controllers/youtube.php and add the following.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Youtube extends Controller
{
function __construct()
{
parent::Controller();

}

function index()
{

    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    $youtube = new Zend_Gdata_YouTube();
    $query = $youtube-&gt;newVideoQuery();
    $query-&gt;videoQuery = 'cat';
    $query-&gt;startIndex = 10;
    $query-&gt;maxResults = 20;
    $query-&gt;orderBy = 'viewCount';

    $data['queryurl'] =  $query-&gt;queryUrl;
    $data['videofeed'] =  $youtube-&gt;getVideoFeed($query);
    $this-&gt;load-&gt;view('youtube_view', $data);
  }
}

?&gt;
</pre>
<h5>views/youtube_view.php</h5>
<p>Create this file and add the following.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

foreach ($videofeed as $videoEntry) {
    echo &quot;---------VIDEO----------&lt;br /&gt;&quot;;
    echo &quot;Title: &quot; . $videoEntry-&gt;getVideoTitle() . &quot;&lt;br /&gt;&quot;;
    echo &quot;\nDescription:&lt;br /&gt;&quot;;
    echo $videoEntry-&gt;getVideoDescription();
    echo &quot;&lt;br /&gt;&lt;br /&gt;&quot;;
}
?&gt;
</pre>
<p>Then visit a new page http://127.0.0.1/codeigniter/index.php/youtube to the result.</p>
<h4>Using Google calendar</h4>
<p>Create controller/googlecalendar.php and add the following. Use your google email and password.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Googlecalendar extends Controller
{
function __construct()
{
parent::Controller();

}

function index()
{
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    // Parameters for ClientAuth authentication

$user = &quot;YOUR gmail HERE&quot;;
$pass = &quot;YOUR PASS&quot;;

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$service = new Zend_Gdata_Calendar($client);

try {
    $listFeed= $service-&gt;getCalendarListFeed();
} catch (Zend_Gdata_App_Exception $e) {
    echo &quot;Error: &quot; . $e-&gt;getMessage();
}
echo &quot;&lt;h1&gt;Calendar List Feed&lt;/h1&gt;&quot;;
echo &quot;&lt;ul&gt;&quot;;
foreach ($listFeed as $calendar) {
    echo &quot;&lt;li&gt;&quot; . $calendar-&gt;title .
         &quot; (Event Feed: &quot; . $calendar-&gt;id . &quot;)&lt;/li&gt;&quot;;
}
echo &quot;&lt;/ul&gt;&quot;;
}
}
?&gt;
</pre>
<p>Then again visit http://127.0.0.1/codeigniter/googlecalendar.</p>
<h4 class="download">
<a href="http://www.box.net/shared/0cxtrq8apq">Download Files</a></h4>
<p>Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/' rel='bookmark' title='Zend framework Youtube class on Codeigniter with jquery'>Zend framework Youtube class on Codeigniter with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Zend framework Youtube class on Codeigniter with jquery</title>
		<link>http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/</link>
		<comments>http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 06:20:50 +0000</pubDate>
		<dc:creator>shinokada</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[XAMPP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[youtube]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.okadadesign.no/blog/?p=504</guid>
		<description><![CDATA[ Download <p>This does not contain Codeigniter or Zend framework. If you need them please download it from here. </p> Introduction <p>The previous post &#8220;Zend Framework on Codeigniter: Youtube&#8221; involved three steps to see a video. And it did not have any style.</p> Goals <p>I will reduce it to two steps, add a minimum [...]
Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fzend-framework-youtube-class-on-codeigniter-with-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.okadadesign.no%2Fblog%2Fxampp%2Fzend-framework-youtube-class-on-codeigniter-with-jquery%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h4>Download</h4>
<p>This does not contain Codeigniter or Zend framework. If you need them please download it from <a href="http://www.okadadesign.no/blog/?p=452">here</a>.  </p>
<h3>Introduction</h3>
<p>The previous post <a href="http://www.okadadesign.no/blog/?p=452">&#8220;Zend Framework on Codeigniter: Youtube&#8221;</a> involved three steps to see a video. And it did not have any style.</p>
<h3>Goals</h3>
<p>I will reduce it to two steps, add a minimum styling and use jquery tools scrollable.<br />
<img src="http://www.okadadesign.no/blog/wp-content/uploads/2009/11/zend_youtube_2_1.jpg" alt="zend_youtube_2_1" title="zend_youtube_2_1" width="460" height="376" class="alignleft size-full wp-image-505" /></p>
<div class="clearboth"></div>
<p><span id="more-504"></span><br />
The default videos in a scrollabe screen will be three. </p>
<h3>Resources</h3>
<ol>
<li>
<a href="http://flowplayer.org/tools/demos/scrollable/vertical.html">Jquery Tools Scrollable</a>: I am using a vertical scrollabe this time.</li>
<li>
<a href="http://framework.zend.com/manual/en/zend.gdata.youtube.html">Zend Framework Youtube class</a></li>
<li><a href="http://codeigniter.com/user_guide/index.html">Codeigniter</a></li>
</ol>
<h3>Config</h3>
<p>system/application/config/autoload.php</p>
<pre class="brush: php; title: ; notranslate">
$autoload['helper'] = array('zend_framework', 'url');
</pre>
<p>Autoload the zend_framework and url.<br />
</p>
<p>system/application/config/config.php</p>
<pre class="brush: php; title: ; notranslate">
$config['base_url']	=&quot;http://127.0.0.1/ci_zend_youtube/&quot;;
</pre>
<p></p>
<p>Add your base url here.</p>
<h3>Controller</h3>
<p>system/application/controllers/yt_scroll.php<br />
</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Yt_scroll extends Controller{
    protected $_youTube;

function __construct() {
    parent::Controller();
    Zend_Loader::loadClass('Zend_Gdata_YouTube');

    $this-&gt;_youTube = new Zend_Gdata_YouTube;

    }

function index(){

    // Gets playlists
    $data['playlistfeed']= $this-&gt;_youTube-&gt;getPlaylistListFeed('NationalGeographic');
    $this-&gt;load-&gt;view ('youtube_view3',$data);
    }

public function listAction(){
    // Gets playlist videos

    $playlistId = $this-&gt;uri-&gt;segment(4);
    $query = $this-&gt;_youTube-&gt;newVideoQuery(
    'http://gdata.youtube.com/feeds/playlists/' . $playlistId);
    $data['videoFeed']= $this-&gt;_youTube-&gt;getVideoFeed($query);
    $this-&gt;load-&gt;view('listaction2_view', $data);
    }

}
</pre>
<p></p>
<h4>Contructor</h4>
<p>A variable $_youTube is created with protected.<br />
Constructor function loads Zend_Gdata_YouTube with Zend_Loader.<br />
And a new object is created.<br />
</p>
<h4>Index () function</h4>
<p>PlaylistListFeed of National Geographic is stored in playlistfeed and this will be loaded in youtube_view3.</p>
<h4>listAction () function</h4>
<p>The fourth segment of uri will be used for $playlistId.<br />
Query is stored to $query and videofeed will be in </p>
<h3>View</h3>
<p>system/application/views/youtube_view3.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
       &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
  &lt;title&gt;Video lists&lt;/title&gt;
 &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;?=base_url();?&gt;css/default.css&quot; /&gt;
 &lt;script src=&quot;http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js&quot;&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;div id=&quot;wrapper&quot;&gt;
&lt;h1&gt;National Geographic Videos on Youtube&lt;/h1&gt;
&lt;div&gt;
&lt;?php foreach ($playlistfeed as $playlistEntry): ?&gt;
&lt;?php $id = substr(strrchr(
$playlistEntry-&gt;getPlaylistVideoFeedUrl(), '/'
), 1); ?&gt;
&lt;h3&gt;
&lt;a href=&quot;yt_scroll/listAction/id/&lt;?php echo $id; ?&gt;/&quot;&gt;
&lt;?php echo $playlistEntry-&gt;title-&gt;text; ?&gt;
&lt;/a&gt;
&lt;/h3&gt;
&lt;div class=&quot;pane&quot;&gt;

&lt;p&gt;&lt;?php echo $playlistEntry-&gt;description-&gt;text; ?&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;?php endforeach; ?&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Conclusion</h3>
<p>You can add a form to submit the video subject like <a href="http://www.okadadesign.no/blog/?p=478">I did for Flickr.</a> You may want to add this to your side column. Pagenation can be added to this.</p>
<p>Related posts:<ol>
<li><a href='http://www.okadadesign.no/blog/xampp/zend-framework-on-codeigniter-youtube/' rel='bookmark' title='Zend Framework on Codeigniter: Youtube'>Zend Framework on Codeigniter: Youtube</a></li>
<li><a href='http://www.okadadesign.no/blog/zend-framework/zend-framework-flickr-class-on-codeignier-with-jquery/' rel='bookmark' title='Zend framework Flickr class on Codeignier with jquery'>Zend framework Flickr class on Codeignier with jquery</a></li>
<li><a href='http://www.okadadesign.no/blog/xampp/how-to-implement-zend-framework-with-codeigniter-on-windows/' rel='bookmark' title='How to implement Zend Framework with Codeigniter'>How to implement Zend Framework with Codeigniter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.okadadesign.no/blog/xampp/zend-framework-youtube-class-on-codeigniter-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

