<?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>zend &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/zend/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Which Model Should Contain That Method?</title>
		<link>/2010/07/28/which-model-should-contain-that-method/</link>
		<comments>/2010/07/28/which-model-should-contain-that-method/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 15:07:41 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Business/Finance]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data management]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database management systems]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[IBM software]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL keywords]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1866</guid>
		<description><![CDATA[Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; Users &#38; Article. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application. What happens if you have to write a getUserArticles method? Where would you put it? Whether this &#8230; <a href="/2010/07/28/which-model-should-contain-that-method/" class="more-link">Continue reading <span class="screen-reader-text">Which Model Should Contain That Method?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; <strong>Users</strong> &amp; <strong>Article</strong>. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application.</p>
<p>What happens if you have to write a getUserArticles method? Where would you put it? Whether this will be the User model or the Article model?<a href="/wp-content/uploads/2010/07/question.jpg"><img class="aligncenter size-full  wp-image-1875" title="question" src="/wp-content/uploads/2010/07/question.jpg" alt="Where?" width="430" height="231" srcset="/wp-content/uploads/2010/07/question.jpg 430w, /wp-content/uploads/2010/07/question-300x161.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Although technically you can put it in both models my advice is to look at the SQL query. If the FROM clause is containing the user table &#8211; than put the method in the User model, but here you&#8217;d have something like:</p>
<pre lang="sql">
SELECT * FROM Article WHERE user_id = 1
</pre>
<p>I&#8217;d prefer to place it in the Article model!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/28/which-model-should-contain-that-method/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend Framework and Media RSS</title>
		<link>/2010/07/13/zend-framework-and-media-rss/</link>
		<comments>/2010/07/13/zend-framework-and-media-rss/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 19:23:32 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer file formats]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Content syndication markup language]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[possible solutions]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1795</guid>
		<description><![CDATA[The Problem Since native RSS format is not designed to deliver media content, there is a need for newer format supporting video and audio. There is such format &#8211; Media RSS introduced by Yahoo! in 2004. Actually now RSS supports some king of pseudo audio and video with the enclosure tag. Although there is a &#8230; <a href="/2010/07/13/zend-framework-and-media-rss/" class="more-link">Continue reading <span class="screen-reader-text">Zend Framework and Media RSS</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/04/30/burn-feeds-in-zend-framework/" rel="bookmark" title="Burn Feeds in Zend Framework">Burn Feeds in Zend Framework </a></li>
<li><a href="/2010/08/23/can-twitter-replace-the-rss-feed-readers/" rel="bookmark" title="Can Twitter Replace the RSS Feed Readers">Can Twitter Replace the RSS Feed Readers </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The Problem</h2>
<p>Since native RSS format is not designed to deliver media content, there is a need for newer format supporting video and audio. There is such format &#8211; <a title="Media Rss Yahoo!" href="http://video.search.yahoo.com/mrss" target="_blank">Media RSS</a> introduced by Yahoo! in 2004. Actually now RSS supports some king of pseudo audio and video with the enclosure tag.</p>
<p><a href="/wp-content/uploads/2010/07/radio-media.jpeg"><img class="aligncenter size-full wp-image-1804" title="Radio Set" src="/wp-content/uploads/2010/07/radio-media.jpeg" alt="Inserting Media In RSS with Media RSS" width="430" height="322" srcset="/wp-content/uploads/2010/07/radio-media.jpeg 430w, /wp-content/uploads/2010/07/radio-media-300x224.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Although there is a standardized format, there is not a Zend Framework native module. There is however a <a title="Zend Framework and Media RSS" href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Feed_Writer_Extension_MediaRSS+-+Justin+Hart" target="_blank">proposal</a>, but that&#8217;s far not enough.</p>
<h2>Possible Solutions</h2>
<p>For me there are two possible solutions. The first is writing Zend_Feed_Mrss and extend the <a href="http://framework.zend.com/apidoc/core/Zend_Feed/Zend_Feed_Rss.html" target="_blank">Zend_Feed_Rss</a> functionality, but that appears to be a non-trivial task. The second solution is to write custom view returning XML, which I&#8217;m choosing for now. I hope I can paste some code soon!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/04/30/burn-feeds-in-zend-framework/" rel="bookmark" title="Burn Feeds in Zend Framework">Burn Feeds in Zend Framework </a></li>
<li><a href="/2010/08/23/can-twitter-replace-the-rss-feed-readers/" rel="bookmark" title="Can Twitter Replace the RSS Feed Readers">Can Twitter Replace the RSS Feed Readers </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/13/zend-framework-and-media-rss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bind Zend Action with Non-Default View &#8211; Part 2</title>
		<link>/2010/06/23/bind-zend-action-with-non-default-view-part-2/</link>
		<comments>/2010/06/23/bind-zend-action-with-non-default-view-part-2/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 14:26:41 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML element]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend view renderer]]></category>

		<guid isPermaLink="false">/?p=1664</guid>
		<description><![CDATA[Typical Setup Typically Zend Framework is setup to bind every controller&#8217;s action to a specific view. The names of the action and the view script must be the same, or at least must be similar &#8211; following the ZF&#8217;s convention. Thus if you name an action, let&#8217;s say, indexAction(), you&#8217;ve to create an index.phtml file &#8230; <a href="/2010/06/23/bind-zend-action-with-non-default-view-part-2/" class="more-link">Continue reading <span class="screen-reader-text">Bind Zend Action with Non-Default View &#8211; Part 2</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/07/bind-zend-action-with-non-default-view/" rel="bookmark" title="Bind Zend Action with Non-Default View">Bind Zend Action with Non-Default View </a></li>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/01/29/escaping-strings-in-a-zend-framework-view-prevent-unclosed-tags/" rel="bookmark" title="Escaping strings in a Zend Framework view. Prevent unclosed tags!">Escaping strings in a Zend Framework view. Prevent unclosed tags! </a></li>
<li><a href="/2010/04/27/inline-scripts-with-zend_view_helper_inlinescript/" rel="bookmark" title="Inline Scripts with Zend_View_Helper_InlineScript">Inline Scripts with Zend_View_Helper_InlineScript </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Typical Setup</h2>
<p>Typically <a href="http://framework.zend.com/">Zend Framework</a> is setup to bind every controller&#8217;s action to a specific view. The names of the action and the view script must be the same, or at least must be similar &#8211; following the ZF&#8217;s convention.</p>
<p>Thus if you name an action, let&#8217;s say, indexAction(), you&#8217;ve to create an index.phtml file into the views/scripts/index/ folder. Let me remind you that this is what is called a typical setup, but this may vary from one installation to another.</p>
<p>Thus everything&#8217;s fine and the MVC does its best. After the user requests a specific uri, the framework parses it and finds the controller, than the action and than the view script &#8211; and there is a view script for every single action.</p>
<p><a href="/wp-content/uploads/2010/06/typical-zend-framework-setup.jpg"><img class="alignleft size-medium wp-image-1675" title="typical-zend-framework-setup" src="/wp-content/uploads/2010/06/typical-zend-framework-setup-300x162.jpg" alt="typical zend framework setup" width="300" height="162" srcset="/wp-content/uploads/2010/06/typical-zend-framework-setup-300x162.jpg 300w, /wp-content/uploads/2010/06/typical-zend-framework-setup.jpg 545w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>When there are two or more actions &#8211; there are two or more .phtml (view scripts) files.</p>
<p><a href="/wp-content/uploads/2010/06/typical-zend-framework-setup2.jpg"><img class="alignleft size-medium wp-image-1676" title="typical-zend-framework-setup2" src="/wp-content/uploads/2010/06/typical-zend-framework-setup2-300x203.jpg" alt="typical zend framework setup for two or more actions" width="300" height="203" srcset="/wp-content/uploads/2010/06/typical-zend-framework-setup2-300x203.jpg 300w, /wp-content/uploads/2010/06/typical-zend-framework-setup2.jpg 630w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<h2>Some Exceptions</h2>
<p>Sometimes you have very similar logic, but very different markup between two actions. As the logic goes to the controller/action and the markup into the view, the question is can you simply have one action in the controller, but with two different .phtml file as a view scripts?  Of course switching between those two (or more) with some conditionals.</p>
<h3>Solution No. 1</h3>
<p>However once I posted a simple, and working, <a href="/2010/06/07/bind-zend-action-with-non-default-view/">solution</a>. There you have again two actions and two scripts:</p>
<pre lang="php">
<?php

class IndexController extends Zend_Controller_Action
{	
	public function firstAction()
	{
		// place all the logic you need here
		// and every view placeholder assignment
		$this->view->title = "My Title";
		
		// if the logic requires a different markup
		// simply redirect to another view
		if (some_expression) {
			$this->_forward('second');	
		}	
	}
	
	public function secondAction()
	{}
}

// in the application/views/scripts/index
// 1. first.phtml
<h1><?php echo $this->title ?></h1>

// 2. second.phtml
<h2><?php echo $this->title ?></h2>
</pre>
<p>As you can see in the second action there&#8217;s no logic &#8211; it&#8217;s only serving the role of a bridge between the views. Everything is setup into the first action, but the second action is doing the relation with the second.phtml view script.</p>
<h3>Solution No. 2</h3>
<p>However there&#8217;s another solution with only one action and two scripts which makes something like that shown on the diagram bellow:</p>
<p><a href="/wp-content/uploads/2010/06/zend-framework-one-action-multiple-views.jpg"><img class="alignleft size-medium wp-image-1677" title="zend-framework-one-action-multiple-views" src="/wp-content/uploads/2010/06/zend-framework-one-action-multiple-views-300x203.jpg" alt="zend framework one action multiple=" height="203" srcset="/wp-content/uploads/2010/06/zend-framework-one-action-multiple-views-300x203.jpg 300w, /wp-content/uploads/2010/06/zend-framework-one-action-multiple-views.jpg 630w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>The only thing to do is to add some code to your action:</p>
<pre lang="php">
<?php

class IndexController extends Zend_Controller_Action
{	
	public function firstAction()
	{
		// place all the logic you need here
		// and every view placeholder assignment
		$this->view->title = "My Title";
		
		// if the logic requires a different markup
		// simply redirect to another view
		if (some_expression) {
			echo $this->view->render('index/second.phtml');
			$this->_helper->viewRenderer->setNoRender(true);
		}	
	}
}

// in the application/views/scripts/index
// 1. first.phtml
<h1><?php echo $this->title ?></h1>

// 2. second.phtml
<h2><?php echo $this->title ?></h2>
</pre>
<p>Note that you&#8217;ve to setNoRender on the view renderer once you render the other script!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/07/bind-zend-action-with-non-default-view/" rel="bookmark" title="Bind Zend Action with Non-Default View">Bind Zend Action with Non-Default View </a></li>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/01/29/escaping-strings-in-a-zend-framework-view-prevent-unclosed-tags/" rel="bookmark" title="Escaping strings in a Zend Framework view. Prevent unclosed tags!">Escaping strings in a Zend Framework view. Prevent unclosed tags! </a></li>
<li><a href="/2010/04/27/inline-scripts-with-zend_view_helper_inlinescript/" rel="bookmark" title="Inline Scripts with Zend_View_Helper_InlineScript">Inline Scripts with Zend_View_Helper_InlineScript </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/23/bind-zend-action-with-non-default-view-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Redirect with Zend Framework</title>
		<link>/2010/06/21/redirect-with-zend-framework/</link>
		<comments>/2010/06/21/redirect-with-zend-framework/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 14:31:10 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[referer]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1652</guid>
		<description><![CDATA[Once I wrote about redirecting with Zend Framework, but what I missed back than was a common mistake. Although the code from my post is working, to be completely correct after redirecting I&#8217;d to add an exit() statement. This is important because the header is changed and if something goes after the redirect there will &#8230; <a href="/2010/06/21/redirect-with-zend-framework/" class="more-link">Continue reading <span class="screen-reader-text">Redirect with Zend Framework</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/11/27/redirecting-with-zend-framework/" rel="bookmark" title="Redirecting with Zend Framework">Redirecting with Zend Framework </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
<li><a href="/2009/12/20/redirecting-with-zend-framework-part-2/" rel="bookmark" title="Redirecting with Zend Framework &#8211; part 2">Redirecting with Zend Framework &#8211; part 2 </a></li>
<li><a href="/2010/07/22/zend_validate_db_recordexists-in-zend-framework-1-10/" rel="bookmark" title="Zend_Validate_Db_RecordExists in Zend Framework 1.10+">Zend_Validate_Db_RecordExists in Zend Framework 1.10+ </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Once I <a title="_redirect with Zend Framework" href="/2010/04/21/setting-a-zend-framework-_redirect-referer/" target="_blank">wrote</a> about redirecting with Zend Framework, but what I missed back than was a common mistake. Although the code from my post is working, to be completely correct after redirecting I&#8217;d to add an exit() statement.</p>
<p>This is important because the header is changed and if something goes after the redirect there will be some problems. Finally the correct snippet is:</p>
<pre lang="php">
public function() {
	$this->_redirect('some_url');
	exit();	
}
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/11/27/redirecting-with-zend-framework/" rel="bookmark" title="Redirecting with Zend Framework">Redirecting with Zend Framework </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
<li><a href="/2009/12/20/redirecting-with-zend-framework-part-2/" rel="bookmark" title="Redirecting with Zend Framework &#8211; part 2">Redirecting with Zend Framework &#8211; part 2 </a></li>
<li><a href="/2010/07/22/zend_validate_db_recordexists-in-zend-framework-1-10/" rel="bookmark" title="Zend_Validate_Db_RecordExists in Zend Framework 1.10+">Zend_Validate_Db_RecordExists in Zend Framework 1.10+ </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/21/redirect-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use Zend_Translate to Translate Your Web App</title>
		<link>/2010/06/15/use-zend_translate-to-translate-your-web-app/</link>
		<comments>/2010/06/15/use-zend_translate-to-translate-your-web-app/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 17:38:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Configuration files]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[INI file]]></category>
		<category><![CDATA[large scale systems]]></category>
		<category><![CDATA[large web system]]></category>
		<category><![CDATA[multilingual site]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[System software]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1614</guid>
		<description><![CDATA[There are some really good reasons to use Zend_Translate for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention. 1. Write a human readable source file In fact you can do this &#8230; <a href="/2010/06/15/use-zend_translate-to-translate-your-web-app/" class="more-link">Continue reading <span class="screen-reader-text">Use Zend_Translate to Translate Your Web App</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>There are some really good reasons to use <a title="Zend_Translate" href="http://framework.zend.com/manual/en/zend.translate.html" target="_blank">Zend_Translate</a> for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention.</p>
<h2>1. Write a human readable source file</h2>
<p>In fact you can do this even without Zend_Translate. Image you&#8217;ve an ini file with some pairs like:</p>
<pre>
lblMyLabel = "My Label"
</pre>
<p>Nobody says this cannot be &#8220;more&#8221; human readable &#8211; like so:</p>
<pre>
My Label = "My Label"
</pre>
<p>Than you can support several files i.e. en.ini, de.ini, etc. where you can translate this label. The problem is that once you read the ini file you&#8217;ve to deal with those white spaces into the labels, while with Zend_Translate you can simply call them with:</p>
<pre lang="php">
$translate->_("My Label");
</pre>
<h2>2. Default values for missing labels</h2>
<p>Zend_Translate forces you to define a source file. Which is really great, because you always have a default value. Assuming that you don&#8217;t have a specific label translated in one of the ini files, you&#8217;ll get the default value from the source file, and defining source and other files is as easy as:</p>
<pre lang="php">
// en.ini
My Label = "My Label"

// de.ini
...

// while the locale is de_DE you'll have 
// the default value returned
$translate->_("My Label"); // will return My Label from the en.ini
</pre>
<h2>3. Locales</h2>
<p>It&#8217;s really great that you can directly setup a locale for this module. Thus you have more flexibility when switching between languages and you can benefit from the power of the framework when reading some browser specific locales. Here&#8217;s some code:</p>
<pre lang="php">
$translate = new Zend_Translate('ini', 'en.ini', 'en');
$translate->addTranslation('de.ini', 'de');

// than when you setup the translation locale
$translate->setLocale('en');
</pre>
<h2>4. Cache</h2>
<p>One of the greatest things about Zend_Translate is the native support of cache. It&#8217;s so cool! Actually the labels of a large web system are pretty static and don&#8217;t change every day. In other hand in large scale systems there are lots of labels, and the load time will be faster with cache.</p>
<pre lang="php">
$frontendOptions = array('lifetime' => 600, 'automatic_serialization' => true);
$backendOptions  = array('cache_dir' => 'path_to_cache_dir');

$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);

Zend_Translate::setCache($cache);
</pre>
<p>It&#8217;s a great advantage to use Zend_Translate after all this. Actually I have finished projects without any use of it, but I really can&#8217;t imagine how I&#8217;ll work now without it!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/15/use-zend_translate-to-translate-your-web-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend_Feed and pubDate&#8217;s Property of an Entry</title>
		<link>/2010/06/06/zend_feed-and-pubdates-property-of-an-entry/</link>
		<comments>/2010/06/06/zend_feed-and-pubdates-property-of-an-entry/#respond</comments>
		<pubDate>Sun, 06 Jun 2010 12:18:17 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1589</guid>
		<description><![CDATA[It seems there is a strange problem with Zend_Feed and an entry pubDate property?! I&#8217;ve added the very minimum of properties for a feed entry &#8211; title, pubDate, link and description, but the resulting date is &#8230; the current date instead of the date specified in the pubDate property? Is there any way to fix &#8230; <a href="/2010/06/06/zend_feed-and-pubdates-property-of-an-entry/" class="more-link">Continue reading <span class="screen-reader-text">Zend_Feed and pubDate&#8217;s Property of an Entry</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/" rel="bookmark" title="Force Zend Casting and Help the IDE Autocompletion">Force Zend Casting and Help the IDE Autocompletion </a></li>
<li><a href="/2009/03/07/jquery-datepicker-issue/" rel="bookmark" title="jQuery datepicker issue">jQuery datepicker issue </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>It seems there is a strange problem with Zend_Feed and an entry pubDate property?!</p>
<p>I&#8217;ve added the very minimum of properties for a feed entry &#8211; title, pubDate, link and description, but the resulting date is &#8230; the current date instead of the date specified in the pubDate property? Is there any way to fix it?</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/" rel="bookmark" title="Force Zend Casting and Help the IDE Autocompletion">Force Zend Casting and Help the IDE Autocompletion </a></li>
<li><a href="/2009/03/07/jquery-datepicker-issue/" rel="bookmark" title="jQuery datepicker issue">jQuery datepicker issue </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/06/zend_feed-and-pubdates-property-of-an-entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Date::setOptions and format_type in Zend Framework 1.10.3</title>
		<link>/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/</link>
		<comments>/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/#respond</comments>
		<pubDate>Wed, 28 Apr 2010 15:52:49 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1516</guid>
		<description><![CDATA[I recently upgraded from the old Zend Framework 1.9.5 to the latest &#8211; 1.10.3. Everything just looked to be working quite fine, except the date formatting. Although I had the same date formatting and options in the old version it seems to be not working. I had the format_type set to PHP and even though &#8230; <a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" class="more-link">Continue reading <span class="screen-reader-text">Zend_Date::setOptions and format_type in Zend Framework 1.10.3</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2009/05/12/zend_date-with-dates-before-1901/" rel="bookmark" title="Zend_Date with dates before 1901">Zend_Date with dates before 1901 </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/04/29/debugging-in-zend-framework/" rel="bookmark" title="Debugging in Zend Framework">Debugging in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>I recently upgraded from the old <a href="http://framework.zend.com/" target="_blank">Zend Framework</a> 1.9.5 to the latest &#8211; 1.10.3. Everything just looked to be working quite fine, except the date formatting. Although I had the same date formatting and options in the old version it seems to be not working.</p>
<p>I had the format_type set to PHP and even though I formatted the dates with a Zend Framework specific format: <strong>&#8220;d MMM yyyy&#8221;</strong>.</p>
<pre lang="php">
Zend_Date::setOptions(array('format_type' => 'php'));
// ...
$date = new Zend_Date($somedate);
echo $date->get('d MMM yyyy');
</pre>
<p>Now as it appears format_type php in 1.10.3 is giving completely different result, and the correct format is date() like format in PHP.</p>
<pre lang="php">
Zend_Date::setOptions(array('format_type' => 'php'));
// ...
$date = new Zend_Date($somedate);
echo $date->get('d M yy');
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2009/05/12/zend_date-with-dates-before-1901/" rel="bookmark" title="Zend_Date with dates before 1901">Zend_Date with dates before 1901 </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/04/29/debugging-in-zend-framework/" rel="bookmark" title="Debugging in Zend Framework">Debugging in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Controller_Router_Route_Regex &#8211; the Power of Regular Expressions</title>
		<link>/2010/04/23/zend_controller_router_route_regex-the-power-of-regular-expressions/</link>
		<comments>/2010/04/23/zend_controller_router_route_regex-the-power-of-regular-expressions/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 12:35:12 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Pattern matching]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Regular expression]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1470</guid>
		<description><![CDATA[I posted once of custom URLs within Zend Framework, but back than I wasn&#8217;t quite sure enough there isn&#8217;t a better, more elegant way to do this job. Of course as it appears, there is! With no need to is to use the power of regular expressions with Zend_Controller_Router_Route_Regex. Thus you can match dynamically the &#8230; <a href="/2010/04/23/zend_controller_router_route_regex-the-power-of-regular-expressions/" class="more-link">Continue reading <span class="screen-reader-text">Zend_Controller_Router_Route_Regex &#8211; the Power of Regular Expressions</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
<li><a href="/2010/04/20/custom-routes-with-zend_controller_router_route/" rel="bookmark" title="Custom Routes with Zend_Controller_Router_Route">Custom Routes with Zend_Controller_Router_Route </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>I posted once of custom URLs within Zend Framework, but back than I wasn&#8217;t quite sure enough there isn&#8217;t a better, more elegant way to do this job. Of course as it appears, there is! With no need to is to use the power of regular expressions with Zend_Controller_Router_Route_Regex. Thus you can match dynamically the URL.</p>
<p>Let&#8217;s assume you&#8217;d like to have a link with something like <strong>www.example.com/3939-some-title-here</strong>. This is really very common. So to proceed you&#8217;d have to have some regex like:</p>
<pre lang="php">
$pattern = '/\d+-.*/;
</pre>
<h2>So what about Zend Framework</h2>
<p>Here the things are going naturally more OOP.</p>
<pre lang="php">
$route = new Zend_Controller_Router_Route_Regex('(\d+)-?(.*)',
                       array('controller' => 'controller_name', 'action' => 'action_name'),
                       array(1 => 'id'));

$ctrl->addRoute('my-route', $route);
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
<li><a href="/2010/04/20/custom-routes-with-zend_controller_router_route/" rel="bookmark" title="Custom Routes with Zend_Controller_Router_Route">Custom Routes with Zend_Controller_Router_Route </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/23/zend_controller_router_route_regex-the-power-of-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Iterate over YouTube Channel with Zend_Gdata_YouTube</title>
		<link>/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/</link>
		<comments>/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 14:07:56 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Atom publishing protocol]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[Gdata services]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[YouTube Inc]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1465</guid>
		<description><![CDATA[Read YouTube&#8217;s Feed in Zend App The task is to read the entire Gdata from a YouTube&#8217;s channel. It may sound easy, but as you may know Gdata is based on the Atom publishing protocol, and it naturally gives you only the latest few items. Of course Zend Framework has a large set of classes &#8230; <a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" class="more-link">Continue reading <span class="screen-reader-text">Iterate over YouTube Channel with Zend_Gdata_YouTube</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/" rel="bookmark" title="Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube">Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/" rel="bookmark" title="Force Zend Casting and Help the IDE Autocompletion">Force Zend Casting and Help the IDE Autocompletion </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Read YouTube&#8217;s Feed in Zend App</h2>
<p>The task is to read the entire <a title="Gdata" href="http://code.google.com/apis/gdata/" target="_blank">Gdata</a> from a YouTube&#8217;s channel. It may sound easy, but as you may know Gdata is based on the Atom publishing protocol, and it naturally gives you only the latest few items.</p>
<p>Of course <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> has a large set of classes dealing with Google&#8217;s Gdata services, one of them is the <a href="http://framework.zend.com/manual/en/zend.gdata.youtube.html" target="_blank">Zend_Gdata_YouTube</a>.</p>
<p>It gives you the power to iterate/paginate over the entire set of YouTube user&#8217;s/channel&#8217;s videos. In that example let&#8217;s assume you have a protected function doing the reading of a single portion:</p>
<pre lang="php" escaped="true">
protected function _process(Zend_Gdata_YouTube_VideoFeed $videoFeed)
{

    /* @var $entry Zend_Gdata_YouTube_VideoEntry */
    foreach ($videoFeed as $entry) {
        /* @var $published Zend_Gdata_App_Extension_Published */
        $published = $entry-&gt;getPublished();
        $thumbnails = $entry-&gt;getVideoThumbnails();

        // set date format
        $date = new Zend_Date($published-&gt;getText());

        // array
        $tags = $entry-&gt;getVideoTags();

        $data['title'] = $entry-&gt;getVideoTitle();
        $data['description'] = $entry-&gt;getVideoDescription();
        $data['date'] = $date-&gt;get('Y-MM-d hh:mm:ss');
        $data['thumb'] = @$thumbnails[3]['url'];
        $data['id'] = $entry-&gt;getVideoId();
        $data['flash_player'] = $entry-&gt;getFlashPlayerUrl();
        $data['tags'] = implode(',', $tags) . ', ' . $entry-&gt;getVideoCategory();
        // do whatever you want with the data
    }

}
</pre>
<p>The only thing left is to iterate over the &#8220;pages&#8221; of the feed. This can be done with getNextFeed() method.</p>
<pre lang="php" escaped="true">
public function readRssAction()
{
    $userId = 'some_user';
    $client = new Zend_Http_Client();
    $gdata = new Zend_Gdata_YouTube($client, 'my-app', null, $this-&gt;_apiKey);
    $videoFeed = $gdata-&gt;getUserUploads($userId);

    // save the last items
    $this-&gt;_process($videoFeed);

    try {
        while ($videoFeed = $videoFeed-&gt;getNextFeed()) {
            $this-&gt;_process($videoFeed);
        }
    } catch (Zend_Gdata_App_Exception $e) {
        echo $e-&gt;getMessage();
    }
}
</pre>
<p>You&#8217;ll get an exception when there is no more feeds to process!</p>
<p>To combine all this into a single controller and to complete the code here&#8217;s the entire source:</p>
<pre lang="php" escaped="true">
class YoutubeController extends Zend_Controller_Action
{
    protected $_apiKey = 'your_api_key_goes_here';

    protected function _process(Zend_Gdata_YouTube_VideoFeed $videoFeed)
    {

        /* @var $entry Zend_Gdata_YouTube_VideoEntry */
        foreach ($videoFeed as $entry) {
            /* @var $published Zend_Gdata_App_Extension_Published */
            $published = $entry-&gt;getPublished();
            $thumbnails = $entry-&gt;getVideoThumbnails();

            // set date format
            $date = new Zend_Date($published-&gt;getText());

            // array
            $tags = $entry-&gt;getVideoTags();

            $data['title'] = $entry-&gt;getVideoTitle();
            $data['description'] = $entry-&gt;getVideoDescription();
            $data['date'] = $date-&gt;get('Y-MM-d hh:mm:ss');
            $data['thumb'] = @$thumbnails[3]['url'];
            $data['id'] = $entry-&gt;getVideoId();
            $data['flash_player'] = $entry-&gt;getFlashPlayerUrl();
            $data['tags'] = implode(',', $tags) . ', ' . $entry-&gt;getVideoCategory();
            // do whatever you want with the data
        }
    }

    public function readRssAction()
    {
        $userId = 'some_user';
        $client = new Zend_Http_Client();
        $gdata = new Zend_Gdata_YouTube($client, 'my-app', null, $this-&gt;_apiKey);
        $videoFeed = $gdata-&gt;getUserUploads($userId);

        // save the last items
        $this-&gt;_process($videoFeed);

        try {
            while ($videoFeed = $videoFeed-&gt;getNextFeed()) {
                $this-&gt;_process($videoFeed);
            }
        } catch (Zend_Gdata_App_Exception $e) {
            echo $e-&gt;getMessage();
        }
    }
}
</pre>
<p><em><strong>Note:</strong> here you&#8217;ve to substitute the API key with the one you&#8217;ve for your development. </em></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/" rel="bookmark" title="Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube">Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/" rel="bookmark" title="Force Zend Casting and Help the IDE Autocompletion">Force Zend Casting and Help the IDE Autocompletion </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zend_Validate_Alnum Doesn&#8217;t Work Correctly</title>
		<link>/2010/04/16/zend_validate_alnum-doesnt-work-correctly/</link>
		<comments>/2010/04/16/zend_validate_alnum-doesnt-work-correctly/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 07:55:18 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1446</guid>
		<description><![CDATA[Zend Framework&#8217;s Zend_Validate I&#8217;m used to validate the form in a typical Zend Framework application with Zend_Validate or course. It gives you the absolute power to use the build in classes for standard validation, as well as write your custom validation classes. The problem I had was a bit odd! Zend_Validate_Alnum is supposed to filter &#8230; <a href="/2010/04/16/zend_validate_alnum-doesnt-work-correctly/" class="more-link">Continue reading <span class="screen-reader-text">Zend_Validate_Alnum Doesn&#8217;t Work Correctly</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/06/23/bind-zend-action-with-non-default-view-part-2/" rel="bookmark" title="Bind Zend Action with Non-Default View &#8211; Part 2">Bind Zend Action with Non-Default View &#8211; Part 2 </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Zend Framework&#8217;s Zend_Validate</h2>
<p>I&#8217;m used to validate the form in a typical <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> application with <a title="Zend_Validate" href="http://framework.zend.com/manual/en/zend.validate.html" target="_blank">Zend_Validate</a> or course. It gives you the absolute power to use the build in classes for standard validation, as well as write your custom validation classes.</p>
<p>The problem I had was a bit odd! <a title="Zend_Validate_Alnum" href="http://framework.zend.com/apidoc/core/Zend_Validate/Zend_Validate_Alnum.html" target="_blank">Zend_Validate_Alnum</a> is supposed to filter all characters and numbers, but what about non Latin symbols!? The project I&#8217;m working on is multilingual and there are eight languages, including Arabic, Chinese and Russian! All these were incorrectly !not validated by Zend_Validate_Alnum, although there were only letters and numbers!</p>
<p>In fact whatever the string encoding was &#8211; it doesn&#8217;t seem to work! Perhaps I&#8217;m wrong, but so far this is the situation.</p>
<h2>Recent Update</h2>
<p>After few test I figured out the problem was not in Zend_Validate at all! My mistake the solution is:</p>
<pre lang="php">
iconv_set_encoding('input_encoding', 'UTF-8');
iconv_set_encoding('output_encoding', 'UTF-8');
iconv_set_encoding('internal_encoding', 'UTF-8');
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/06/23/bind-zend-action-with-non-default-view-part-2/" rel="bookmark" title="Bind Zend Action with Non-Default View &#8211; Part 2">Bind Zend Action with Non-Default View &#8211; Part 2 </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/16/zend_validate_alnum-doesnt-work-correctly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
