<?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 Framework in Action &#187; Tips and Tricks</title>
	<atom:link href="http://www.zendframeworkinaction.com/category/tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zendframeworkinaction.com</link>
	<description>A book about Zend Framework</description>
	<lastBuildDate>Wed, 01 Feb 2012 10:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Validating URIs in Zend_Form</title>
		<link>http://www.zendframeworkinaction.com/2008/08/08/validating-uris-in-zend_form/</link>
		<comments>http://www.zendframeworkinaction.com/2008/08/08/validating-uris-in-zend_form/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 09:05:57 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Around the web]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/?p=64</guid>
		<description><![CDATA[Sudheer has posted an article over on LAMPComputing.com on how to Valdiate URIs in form fields by using a custom validator. I came across a situation where I had to write a custom class to validate URIs. To write the custom URI validator I made use of Zend_Uri which aids in manipulating and validating Uniform [...]]]></description>
			<content:encoded><![CDATA[<p>Sudheer has posted an article over on LAMPComputing.com on how to <a href="http://techchorus.net/validate-uri-form-fields-zend-framework-custom-validator">Valdiate URIs in form fields</a> by using a custom validator.</p>

<blockquote>I came across a situation where I had to write a custom class to validate URIs. To write the custom URI validator I made use of Zend_Uri which aids in manipulating and validating Uniform Resource Identifiers (URIs). In particular I used Zend_Uri::check() function to validate the URI in question.</blockquote>

<p>He then goes on to show how he created his validator class and how to use it with Zend_Form.</p>

<p><em>Edit 15 Apr 2009</em>: Updated link as site has moved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/08/08/validating-uris-in-zend_form/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moving existing applications to Zend Framework</title>
		<link>http://www.zendframeworkinaction.com/2008/03/20/moving-existing-applications-to-zend-framework/</link>
		<comments>http://www.zendframeworkinaction.com/2008/03/20/moving-existing-applications-to-zend-framework/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 05:41:32 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/2008/03/20/moving-existing-applications-to-zend-framework/</guid>
		<description><![CDATA[Unless I am the only one, there are probably a lot of you that are looking at existing applications and thinking about moving them to use Zend Framework. In this thread on the author forum a user (thanks geetarista) pointed to an interesting article by Chris Abernethy on Migrating to Zend Framework: Legacy Scripts. Migrating [...]]]></description>
			<content:encoded><![CDATA[<p>Unless I am the only one, there are probably a lot of you that are looking at existing applications and thinking about moving them to use Zend Framework. In <a href="http://www.manning-sandbox.com/thread.jspa?threadID=23577&#038;tstart=0">this thread on the author forum</a> a user (thanks geetarista) pointed to an interesting article by Chris Abernethy on <a href="http://www.chrisabernethy.com/zend-framework-legacy-scripts/">Migrating to Zend Framework: Legacy Scripts</a>.</p>

<blockquote>Migrating an existing PHP application to Zend Framework can be a daunting task, especially if the migration must occur all at once. It is much easier to migrate the application in sections over a longer period of time.</blockquote>

<p>Having not tested his idea yet I can&#8217;t say how effective it is but the idea looks good.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/03/20/moving-existing-applications-to-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Careful where you set your doctype</title>
		<link>http://www.zendframeworkinaction.com/2008/02/24/careful-where-you-set-your-doctype/</link>
		<comments>http://www.zendframeworkinaction.com/2008/02/24/careful-where-you-set-your-doctype/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 13:36:39 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[doctype]]></category>
		<category><![CDATA[view helper]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/2008/02/24/careful-where-you-set-your-doctype/</guid>
		<description><![CDATA[Along with the resolution of this view helper bug concerning view helpers not being doctype aware, comes a small gotcha if you are relying on setting your doctype in layouts like so: echo $this->doctype('XHTML1_STRICT'); The problem is that view helpers will not be aware of this setting and will revert to the default setting HTML4_LOOSE. [...]]]></description>
			<content:encoded><![CDATA[<p>Along with the resolution of <a href="http://framework.zend.com/issues/browse/ZF-2398" title="Issue: Zend_View_Helper_HeadLink should be Doctype-aware">this view helper bug</a> concerning view helpers not being doctype aware, comes a small gotcha if you are relying on setting your doctype in layouts like so:</p>

<p><code>echo $this->doctype('XHTML1_STRICT');</code></p>

<p>The problem is that view helpers will not be aware of this setting and will revert to the default setting HTML4_LOOSE. To avoid this be sure to set the doctype earlier in the bootstrap process, something like so:</p>

<p><code>$viewRenderer->view->doctype('XHTML1_STRICT');</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/02/24/careful-where-you-set-your-doctype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Db_Table_Abstract in version 1.5</title>
		<link>http://www.zendframeworkinaction.com/2008/01/30/zend_db_table_abstract-in-version-15/</link>
		<comments>http://www.zendframeworkinaction.com/2008/01/30/zend_db_table_abstract-in-version-15/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 22:01:57 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/2008/01/30/zend_db_table_abstract-in-version-15/</guid>
		<description><![CDATA[Zend_Db_Table has been significantly enhanced for version 1.5, mainly by Simon Mundy and is really really good. It&#8217;s going to take me a while to poke around and find out all the new nuances! However, I did find one gotcha that has affected me on my main project at work. If you happen to have [...]]]></description>
			<content:encoded><![CDATA[<p>Zend_Db_Table has been significantly enhanced for version 1.5, mainly by Simon Mundy and is really really good. It&#8217;s going to take me a while to poke around and find out all the new nuances!</p>

<p>However, I did find one gotcha that has affected me on my main project at work.</p>

<p>If you happen to have extended Zend_Db_Table_Abstract::_fetch() for some reason or another, be aware that it&#8217;s changed in version 1.5.</p>

<p>It was:
[php]
/**
 * Support method for fetching rows.
 *
 * @param  string|array $where  OPTIONAL An SQL WHERE clause.
 * @param  string|array $order  OPTIONAL An SQL ORDER clause.
 * @param  int          $count  OPTIONAL An SQL LIMIT count.
 * @param  int          $offset OPTIONAL An SQL LIMIT offset.
 * @return array The row results, in FETCH_ASSOC mode.
 */
protected function _fetch($where = null, $order = null, $count = null, $offset = null)
{
    // lots of stuff
}
[/php]</p>

<p>and is now:
[php]
/**
 * Support method for fetching rows.
 *
 * @param  Zend_Db_Table_Select $select  query options.
 * @return array An array containing the row results in FETCH_ASSOC mode.
 */
protected function _fetch(Zend_Db_Table_Select $select)
{
    // much less stuff
}
[/php]</p>

<p>Just a heads-up in case someone else has customised this function for their own needs.</p>

<p>Related to this, Ralph Eggert recently discovered something else related 1.5 changes when extending Zend_Db_Table_Abstract and Simon Mundy helped out. The select object that is the parameter to _fetch() has a check in it to prevent you joining to another table. This is because if you join, you break the concept that a Zend_Db_Table represents a single table. However, you can get around it using the function setIntegrityCheck() like this:</p>

<p>[php]
protected function _fetch(Zend_Db_Table_Select $select)
{
    // extend select
    $select->setIntegrityCheck(false);
    $select->join(// do stuff);
}
[/php]</p>

<p>The setIntegrityCheck() statement allows you to do a join in the select object and very cleverly puts the table object into read only mode, which is great.</p>

<p>Also, <a href="http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.fetching.dependent.example-by">Example 10.136 of the Zend_Db_Table documentation</a> has more information on how to use the $select to get back the data you actually want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/01/30/zend_db_table_abstract-in-version-15/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Gotcha when using Zend_Form from the incubator</title>
		<link>http://www.zendframeworkinaction.com/2008/01/30/gotcha-when-using-zend_form-from-the-incubator/</link>
		<comments>http://www.zendframeworkinaction.com/2008/01/30/gotcha-when-using-zend_form-from-the-incubator/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 02:10:50 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/2008/01/30/gotcha-when-using-zend_form-from-the-incubator/</guid>
		<description><![CDATA[With my workload now getting a little more manageable, I can finally join Rob and keep this site full of useful updates and info. For my first, here is a small gotcha for those, like myself, who like to work on the occasionally painful cutting edge of Zend Framework development. If you are have the [...]]]></description>
			<content:encoded><![CDATA[<p>With my workload now getting a little more manageable, I can finally join Rob and keep this site full of useful updates and info. For my first, here is a small gotcha for those, like myself, who like to work on the occasionally painful cutting edge of Zend Framework development.</p>

<p>If you are have the incubator in your include path and are playing around with Zend_Form you may get something like the following error&#8230;</p>

<p><code>Zend_Form::__toString() must not throw an exception</code></p>

<p>&#8230;unless you remember to add the incubator view helper path in your controller like so:</p>

<p><code>$this->view->setHelperPath('/path/to/trunk/incubator/library/Zend/View/Helper/');</code></p>

<p>The reason being that Zend_Form has a few view helpers that it needs from the incubator.</p>

<p>Otherwise, you can avoid this issue entirely by just using the 1.5.0 Preview Release.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/01/30/gotcha-when-using-zend_form-from-the-incubator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Difference between two dates</title>
		<link>http://www.zendframeworkinaction.com/2008/01/27/difference-between-two-dates/</link>
		<comments>http://www.zendframeworkinaction.com/2008/01/27/difference-between-two-dates/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 09:05:17 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.zendframeworkinaction.com/2008/01/27/difference-between-two-dates/</guid>
		<description><![CDATA[In response to a mailing list question, Thomas, the lead developer of the I18n components pointed out that to find the difference between two Zend_Dates, you just have to subtract them: [php] $date = Zend_Date::now(); $diff = $date->sub($birthdate); $diff->toString(); [/php] Useful tip, that I&#8217;ve put here mainly so that I can find it again when [...]]]></description>
			<content:encoded><![CDATA[<p>In response to a mailing list question, Thomas, the lead developer of the I18n components pointed out that to find the difference between two Zend_Dates, you just have to subtract them:</p>

<p>[php]
$date = Zend_Date::now();
$diff = $date->sub($birthdate);
$diff->toString();
[/php]</p>

<p>Useful tip, that I&#8217;ve put here mainly so that I can find it again when I need it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendframeworkinaction.com/2008/01/27/difference-between-two-dates/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.zendframeworkinaction.com @ 2012-02-05 01:32:50 -->
