<?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>Просто про веб технологии &#187; ZendFramework</title>
	<atom:link href="http://pro100pro.com/category/development/zendframework/feed" rel="self" type="application/rss+xml" />
	<link>http://pro100pro.com</link>
	<description>Про PHP, MySQL, Sphinx и Zend Framework, про архитектуру и производителность, про высокие нагрузки и масштабирование</description>
	<lastBuildDate>Fri, 10 Sep 2010 07:31:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Как создавать Providers для Zend_Tool</title>
		<link>http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool</link>
		<comments>http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool#comments</comments>
		<pubDate>Sat, 03 Jul 2010 12:02:32 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[providers]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Tool]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=456</guid>
		<description><![CDATA[Matthew Weier O&#8217;Phinney ведущий разработчик Zend Framework опубликовал новую статью про то, как создавать Providers для Zend_Tool.
В общем провайдеры (providers) Zend Tool отвечают за команды выполняемые через командную строку, CLI &#8211; приложений. Например таких как крон скрипты, миграционные скрипты и т.п.
Советую прочитать статью Matthew о провайдерах, чтоб ближе узнать о том, что представлят собой командная [...]]]></description>
			<content:encoded><![CDATA[<p>Matthew Weier O&#8217;Phinney ведущий разработчик Zend Framework опубликовал новую статью про то, <a href="http://weierophinney.net/matthew/archives/242-Creating-Zend_Tool-Providers.html">как создавать Providers для Zend_Tool</a>.<br />
В общем провайдеры (providers) Zend Tool отвечают за команды выполняемые через командную строку, CLI &#8211; приложений. Например таких как крон скрипты, миграционные скрипты и т.п.<br />
Советую прочитать статью Matthew о провайдерах, чтоб ближе узнать о том, что представлят собой командная строка Zend Tool.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2010. |
<a href="http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool">Permalink</a> |
<a href="http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool&title=Как создавать Providers для Zend_Tool">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/command-line" rel="tag">Command line</a>, <a href="http://pro100pro.com/tag/providers" rel="tag">providers</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a>, <a href="http://pro100pro.com/tag/zend-tool" rel="tag">Zend Tool</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/kak-sozdavat-providers-dlya-zend_tool/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Создание простого доступа к ресурсам из ZF контроллера</title>
		<link>http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera</link>
		<comments>http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:08:56 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Action Helpers]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=439</guid>
		<description><![CDATA[Было бы очень хорошо иметь возможность доступа к загружаемым в bootstrap ресурсам из контроллеров приложения. Например, я хотел бы получить доступ к "DB" ресурсу из контроллера следующим образом $this->db;
Для этого напишем Action Helper, который будет загружать определенные ресурсы в контроллер приложения:]]></description>
			<content:encoded><![CDATA[<p>Было бы очень хорошо иметь возможность доступа к загружаемым в bootstrap ресурсам из контроллеров приложения. Например, я хотел бы получить доступ к "DB" ресурсу из контроллера следующим образом $this->db;<br />
Для этого напишем Action Helper, который будет загружать определенные ресурсы в контроллер приложения:</p>
<div class="igBar"><span id="lcode-1"><a href="#" onclick="javascript:showPlainTxt('code-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-1">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class My_ResourceInjector extends Zend_Controller_Action_Helper_Abstract</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; protected $_resources;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public function __construct<span style="color:#006600; font-weight:bold;">&#40;</span>array $resources = array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;_resources = $resources;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public function preDispatch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $bootstrap&nbsp; = $this-&gt;<span style="">getBootstrap</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $controller = $this-&gt;<span style="">getActionController</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; foreach <span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;_resources as $name<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>$bootstrap-&gt;<span style="">hasResource</span><span style="color:#006600; font-weight:bold;">&#40;</span>$name<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $controller-&gt;$name = $bootstrap-&gt;<span style="">getResource</span><span style="color:#006600; font-weight:bold;">&#40;</span>$name<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public function getBootstrap<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return $this-&gt;<span style="">getFrontController</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">getParam</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'bootstrap'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>и инициализируем его в bootstrap:</p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showPlainTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class Bootstrap extends Zend_Application_Bootstrap_Bootstrap</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; protected function _initResourceInjector<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Zend_Controller_Action_HelperBroker::<span style="">addHelper</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new My_ResourceInjector<span style="color:#006600; font-weight:bold;">&#40;</span>array<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'db'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'layout'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'navigation'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Код выше, создаст ссылки на ресурсы: db, layout и navigation. Это значит, что теперь вы можете получить к ним прямой доступ из контроллеров.</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showPlainTxt('code-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class FooController extends Zend_Controller_Action</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public function barAction<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;<span style="">layout</span>-&gt;<span style="">disableLayout</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $model = $this-&gt;<span style="">getModel</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $model-&gt;<span style="">setDbAdapter</span><span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;<span style="">db</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;<span style="">view</span>-&gt;<span style="">assign</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'model'</span>&nbsp; &nbsp; &nbsp; =&gt; $this-&gt;<span style="">model</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'navigation'</span> =&gt; $this-&gt;<span style="">navigation</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// ...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Этото решение ведет к некоторому упрощению - теперь нет необходимости вытягивать bootstrap из объекта инициализации, а потом вытягивать ресурс.<br />
Но, у этого решения есть несколько проблем: Откуда мы знаем, какие ресурсы были связаны с контроллером? Как мы можем это контролировать?<br />
Отсюда, вытекает решение создать пул необходимых ресурсов для контроллера.<br />
(...)<br/>Read the rest of <a href="http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera">Создание простого доступа к ресурсам из ZF контроллера</a> (334 words)</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2010. |
<a href="http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera">Permalink</a> |
<a href="http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera&title=Создание простого доступа к ресурсам из ZF контроллера">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/action-helpers" rel="tag">Action Helpers</a>, <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/sozdanie-prostogo-dostupa-k-resursam-iz-zf-kontrollera/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Настраиваем PHPUnit тесты в Zend Framework 1.10</title>
		<link>http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10</link>
		<comments>http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10#comments</comments>
		<pubDate>Tue, 09 Feb 2010 15:00:36 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[ZendFramework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=422</guid>
		<description><![CDATA[В документации к Zend Framework есть описание как создавать PHPUnit тесты для контроллеров и для баз данных. Но, к сожалению они не объясняют как настроить приложения для выполнения Unit тестов. Попробуем создать среду окружения для выполнения тестов. В общем, если вы выполните все инструкции и скопируете исходные коды, то у вас все должно заработать. Если же что то не работает, спрашивайте в комментариях к статье.]]></description>
			<content:encoded><![CDATA[<p>В документации к Zend Framework есть описание как создавать PHPUnit тесты для контроллеров и для баз данных. Но, к сожалению они не объясняют как настроить приложения для выполнения Unit тестов.<br />
В данной статье приведены шаги по настройке Unit тестов:<br />
1. Установка phpunit<br />
2. Установка xdebug<br />
3. Настройка phpunit.xml<br />
4. Создание TestHelper.php для инициализации приложения<br />
5. Написание и выполнение простого теста</p>
<p>В первую очередь для выполнения тестов нам понадобится phpunit, который можео установить из PEAR пакета PHPUnit.</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showPlainTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ pear channel-discover pear.<span style="">phpunit</span>.<span style="">de</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ pear config-set preferred_state alpha</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ pear install phpunit/PHPUnit</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">or you may wish to install all the optional supporting packages:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ nano /usr/local/php5/etc/php.<span style="">ini</span>&nbsp; <span style="color:#FF9933; font-style:italic;">// memory_limit = 32M; change this to at least 32M</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// if you get a permission denied error on the ZF community server, send an email to fw-servers mail list</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ pear install --alldeps&nbsp; phpunit/PHPUnit </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Следующим шагом установим xdebug. Xdebug мы будем использовать для проверки покрытие кода тестами.</p>
<div class="igBar"><span id="lcode-9"><a href="#" onclick="javascript:showPlainTxt('code-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-9">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ pecl install xdebug-beta </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Теперь откройте ваш php.ini файл и пропишите загрузку xdebug.</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">zend_extension=/usr/lib/..../..../php5/<span style="color:#800000;color:#800000;">20060613</span>/xdebug.<span style="">so</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>(...)<br/>Read the rest of <a href="http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10">Настраиваем PHPUnit тесты в Zend Framework 1.10</a> (108 words)</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2010. |
<a href="http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10">Permalink</a> |
<a href="http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10#comments">4 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10&title=Настраиваем PHPUnit тесты в Zend Framework 1.10">del.icio.us</a>
<br/>
Post tags: <br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/nastraivaem-phpunit-testy-v-zend-framework-1-10/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Как вы используете Sphinx Search API?</title>
		<link>http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api</link>
		<comments>http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api#comments</comments>
		<pubDate>Mon, 21 Dec 2009 19:54:28 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[LinkAider]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Sphinx Search]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=400</guid>
		<description><![CDATA[Sphinx Search API для PHP  пердставляет собой единый класс, который позволяет использовать все возможности Sphinx Search через его интерфейс. Но, такой класс является удобным только для небольших скриптов и задач. 
Для более сложных задач и больших веб приложений необходимо другое решение. И это решения является проектированием и реализацией собственной обертки для Sphinx Search API.]]></description>
			<content:encoded><![CDATA[<p>Sphinx Search API для PHP  пердставляет собой единый класс, который позволяет использовать все возможности Sphinx Search через его интерфейс. Но, такой класс является удобным только для небольших скриптов и задач.<br />
Для более сложных задач и больших веб приложений необходимо другое решение. И это решения является проектированием и реализацией собственной обертки для Sphinx Search API.</p>
<p>В нашем проекте LinkAider.com мы используем следующие понятия и классы при работе с Sphinx Search:</p>
<ol>
<li>Сфинкс клиент, отвечающий за подключение, выполнение запросов и обработку ошибок. Для разработчика сфинкс клиент невидим, мы только сообщаем ему параметры подключения к searchd.</li>
<li>Сфинкс индекс - это один из основных классов, с которым работает разработчик, этот класс отвечает за формирование запросов и выполнение запросов через Сфинкс клиент, а также за обработку результатов запроса.</li>
<li>Сфинкс запрос - это еще один класс к которому обращается разработчик для составления запросов. Каждый запрос отвечает за свои индекс к которому обращается, а также содержит свои фильтры, группировки, сортировки и собственно сам запрос.</li>
<li>Сфинкс результат - это класс, который разбирает ответ сфинкса и предоставляет удобный интерфейс к информации по каждому запросу, также он содержит информацию об ошибках, которую испльзуетя Сфинкс клиент для логирования. Сфинкс результат используется разработчиками для создания запросов к базе данных и получения искомых данных.</li>
</ol>
<p>Пример работы выглядит следующим образом:</p>
<ol>
<li>Мы создаем объект Сфинкс индекс, который инициализирует Сфинкс клиент, устанавливая для него параметры подключения.</li>
<li>Потом мы создаем объекты запросы для каждого указываем фильтры, группировки и т.п., и  указываем к какому индексу делать запрос. Запросов может быть один или несколько, несколько запросов обрабатываються паралельно, что улучшает общую производительность системы.</li>
<li>Каждый созданный запрос мы добавляем в Сфинкс индекс, при добавлении мы можем также указатьк какому индексу делать запрос.</li>
<li>Специальный метод Run класса Сфинкс индекс запускает все запросы и как результат возвращает нам объект Сфинкс результат.</li>
<li>Данные из Сфинкс результата мы используем чтоб создать запросы к базе данных и получить искомые данные.</li>
</ol>
<p>Преимущеста, которые мы получем от работы с такой библотекой - это простота. Разработчик используя объект Сфинкс запрос может выполнять любые запросы.<br />
Сфинкс результат предоставляет удобную обертку над массивом результата.<br />
Нет необходимости помнить множество констант SphinxClient и парсить массив результата. В общем это выглдит так, как будто вы работаете с обычной таблицой, но не до конца. :)</p>
<p>Недостатки в том, что нам все еще приходится вручную связывать результат с таблицами, что может привести к ошибкам и неэффективному коду.</p>
<p>Решение я вижу, в привязке каждого запроса к определенной таблице или группе таблиц.</p>
<p>По описнной выше логике я разрабатываю модуль Sphinx Search для Zend Framework, который я планирую выложить в откртый доступ очень скоро, возможно к новому году.</p>
<p>Поэтому хотелось бы узнать как вы используете Sphinx Search и какие преимущества и недостатки вывидите у вашего подхода.</p>
<p>Буду рад любым советам и рекомендациям.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api">Permalink</a> |
<a href="http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api&title=Как вы используете Sphinx Search API?">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/development" rel="tag">Development</a>, <a href="http://pro100pro.com/tag/linkaider" rel="tag">LinkAider</a>, <a href="http://pro100pro.com/tag/sphinx-search" rel="tag">Sphinx Search</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/kak-vy-ispolzuete-sphinx-search-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Простой загрузчик файлов для Zend Framework</title>
		<link>http://pro100pro.com/prostoy-loader-failov-zendframework</link>
		<comments>http://pro100pro.com/prostoy-loader-failov-zendframework#comments</comments>
		<pubDate>Thu, 17 Dec 2009 13:26:05 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Code snippet]]></category>
		<category><![CDATA[File Loader]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=392</guid>
		<description><![CDATA[Сегодня увидел хороший code snippet простого лоадера файлов в проект на Zend Framework.
PLAIN TEXT
CODE:




class App_Application_Resource_Fileloader extends Zend_Application_Resource_ResourceAbstract &#123;


&#160; /**


&#160; &#160;* @return null


&#160; &#160;*/


&#160;


public function init&#40;&#41; &#123;


&#160; &#160; &#160; &#160; $options = $this-&#62;getOptions &#40;&#41;;


&#160; &#160; &#160; &#160; foreach &#40;$options as $filePath&#41;


&#160; &#160; &#160; &#160; &#160; &#160; include $filePath;


return null;


&#160; &#160; &#160; &#160; 


&#160; &#160; &#125;


&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Сегодня увидел хороший code snippet простого лоадера файлов в проект на Zend Framework.</p>
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showPlainTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class App_Application_Resource_Fileloader extends Zend_Application_Resource_ResourceAbstract <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;* @return null</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public function init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $options = $this-&gt;<span style="">getOptions</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; foreach <span style="color:#006600; font-weight:bold;">&#40;</span>$options as $filePath<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include $filePath;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">return null;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">fileLoader</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = LIBRARY_PATH <span style="color:#CC0000;">"/App/Regex_Functions.php"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">fileLoader</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = LIBRARY_PATH <span style="color:#CC0000;">"/App/Api_Functions.php"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/prostoy-loader-failov-zendframework">Permalink</a> |
<a href="http://pro100pro.com/prostoy-loader-failov-zendframework#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/prostoy-loader-failov-zendframework&title=Простой загрузчик файлов для Zend Framework">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/code-snippet" rel="tag">Code snippet</a>, <a href="http://pro100pro.com/tag/file-loader" rel="tag">File Loader</a>, <a href="http://pro100pro.com/tag/zend" rel="tag">zend</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/prostoy-loader-failov-zendframework/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autoload своих библотек в Zend Framework 1.8+</title>
		<link>http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8</link>
		<comments>http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8#comments</comments>
		<pubDate>Fri, 11 Dec 2009 16:49:09 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Loader]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=389</guid>
		<description><![CDATA[Чтоб загружать в Zend Framework свои библиотеки, нам надо сделать следующее:
Первое - это добавить физический путь к библиотеке в include_path.
Второе - это указать префикс классов библиотеки, если такой вообще используется.
Добавить путь в include_path можно двумя способами:
1. Жетско прописать путь в public/index.php файле:
PLAIN TEXT
CODE:




set_include_path&#40;implode&#40;PATH_SEPARATOR, array&#40;


&#160; &#160; realpath&#40;APPLICATION_PATH . '/../library'&#41;,


&#160; &#160; realpath&#40;APPLICATION_PATH . '/../mylib'&#41;,


&#160; &#160; get_include_path&#40;&#41;,


&#41;&#41;&#41;; 






2. [...]]]></description>
			<content:encoded><![CDATA[<p>Чтоб загружать в Zend Framework свои библиотеки, нам надо сделать следующее:<br />
Первое - это добавить физический путь к библиотеке в include_path.<br />
Второе - это указать префикс классов библиотеки, если такой вообще используется.</p>
<p>Добавить путь в include_path можно двумя способами:<br />
1. Жетско прописать путь в public/index.php файле:</p>
<div class="igBar"><span id="lcode-22"><a href="#" onclick="javascript:showPlainTxt('code-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-22">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set_include_path<span style="color:#006600; font-weight:bold;">&#40;</span>implode<span style="color:#006600; font-weight:bold;">&#40;</span>PATH_SEPARATOR, array<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; realpath<span style="color:#006600; font-weight:bold;">&#40;</span>APPLICATION_PATH . <span style="color:#CC0000;">'/../library'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; realpath<span style="color:#006600; font-weight:bold;">&#40;</span>APPLICATION_PATH . <span style="color:#CC0000;">'/../mylib'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; get_include_path<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
2. Прописать путь в конфигруационном файле application/configs/application.ini</p>
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showPlainTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">includePaths.<span style="">mylib</span> = APPLICATION_PATH <span style="color:#CC0000;">"/../mylib"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
В обоих случаях мы добавляем путь к mylib в include_path. Второй способ более предпочтительный, так как на основе выбранной конфигурации (production, develeopment, test) можно устанавливать путь к различным версиям mylib.<br />
Кстати используя этот же прием, можно устанавливать путь и к каталогу library/Zend и на основе конфигураций подгружать различный версии Zend Framework.</p>
<p>И так, второе что нам необходимо сделать - это подключить автозагрузчик и установить префикс используемый классами библиотеки.<br />
Я прописал автозагрузчик в файле public/index.php</p>
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showPlainTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">require_once <span style="color:#CC0000;">'Zend/Loader/Autoloader.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$loader = Zend_Loader_Autoloader::<span style="">getInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$loader-&gt;<span style="">registerNamespace</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'My_'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
В данном случае префикс классов в моей библиотеки "My_".</p>
<p>Также, этот же код можно прописать и в классе Bootstrap.php</p>
<div class="igBar"><span id="lcode-25"><a href="#" onclick="javascript:showPlainTxt('code-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-25">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">protected function _initAutoload<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; require_once <span style="color:#CC0000;">'Zend/Loader/Autoloader.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $loader = Zend_Loader_Autoloader::<span style="">getInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $loader-&gt;<span style="">registerNamespace</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'My'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Все, теперь ZF знает как загружать классы из вашей бибилиотеки.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8">Permalink</a> |
<a href="http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8&title=Autoload своих библотек в Zend Framework 1.8+">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/loader" rel="tag">Loader</a>, <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/autoload-svoix-biblotek-v-zend-framework-1-8/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Введение в Unit тестрование на Zend Framework 1.8+</title>
		<link>http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8</link>
		<comments>http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8#comments</comments>
		<pubDate>Mon, 02 Nov 2009 06:06:07 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Clear Code]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[ZendFramework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=363</guid>
		<description><![CDATA[Michelangelo van Dam написал краткое введение в Unit тестрование на Zend Framework 1.8+.
Так как версия Zend Framwork 1.8 была сильно переработана, то по сути это первое руководство описывающее как писать Unit тесты в ZF 1.8+.
Начиная с этого момента, можно сказать, что теперь разработчикам не на что жаловаться - руководство есть, начинаем писать тесты. :)

© Yaroslav [...]]]></description>
			<content:encoded><![CDATA[<p>Michelangelo van Dam написал краткое <a href="http://www.dragonbe.com/2009/11/unit-testing-with-zend-framework-18.html">введение в Unit тестрование на Zend Framework 1.8+</a>.<br />
Так как версия Zend Framwork 1.8 была сильно переработана, то по сути это первое руководство описывающее как писать Unit тесты в ZF 1.8+.<br />
Начиная с этого момента, можно сказать, что теперь разработчикам не на что жаловаться - руководство есть, начинаем писать тесты. :)</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8">Permalink</a> |
<a href="http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8&title=Введение в Unit тестрование на Zend Framework 1.8+">del.icio.us</a>
<br/>
Post tags: <br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/vvedenie_unit_testing_on_zend_framework_1_8/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Пример использования Sphinx и Lucene на ZF для разбора почты</title>
		<link>http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails</link>
		<comments>http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:47:07 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sphinx Search]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[email parser]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=282</guid>
		<description><![CDATA[Vikram Vaswani написал замечательный пост о том как используя Sphinx, Zend Framework и Lucene, создать поиск по почтовым сообщениям.
В статье рассказывается об основах использования Sphinx и Lucene, а также об основах разбора почтовых сообщений.  В качестве примера Vikram создает консольное приложение для индексации почты и для поиска по ней используя сначала Lucene, а потом и [...]]]></description>
			<content:encoded><![CDATA[<p>Vikram Vaswani написал <a href="http://devzone.zend.com/article/4887-Indexing-Email-Messages-with-PHP-Zend-Lucene-and-Sphinx">замечательный пост</a> о том как используя Sphinx, Zend Framework и Lucene, создать поиск по почтовым сообщениям.</p>
<p>В статье рассказывается об основах использования Sphinx и Lucene, а также об основах разбора почтовых сообщений.  В качестве примера Vikram создает консольное приложение для индексации почты и для поиска по ней используя сначала Lucene, а потом и Sphinx.</p>
<p>В общем статья является хорошим примером как используя Sphinx и Lucene быстро сделать поисковик.</p>
<p>Если вы интересуетесь поисковыми движками, то наряду с Sphinx стоит обратить внимание на Solr.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails">Permalink</a> |
<a href="http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails&title=Пример использования Sphinx и Lucene на ZF для разбора почты">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/email-parser" rel="tag">email parser</a>, <a href="http://pro100pro.com/tag/lucene" rel="tag">Lucene</a>, <a href="http://pro100pro.com/tag/sphinx-search" rel="tag">Sphinx Search</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/using-sphinx-lucene-with-zendframework-for-parse-emails/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Настраиваем Zend Application</title>
		<link>http://pro100pro.com/nastraivaem-zend-application</link>
		<comments>http://pro100pro.com/nastraivaem-zend-application#comments</comments>
		<pubDate>Thu, 13 Aug 2009 10:14:35 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[Zend Application]]></category>
		<category><![CDATA[Zend Bootstrap]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=252</guid>
		<description><![CDATA[С выходом Zend Framework 1.8 связано много новых изменений и дополнений. Самые значительные это добавление Zend_Application и Zend_Tool.
Zend_Tool представляет собой консольную программу управления проектами на Zend Framework.
Zend_Application это новая система загрузки приложения и конфигурирования проекта.
Рассмотрим как работать с Zend_Application подробнее.
Управление загрузкой приложения занимается Zend_Application_Bootstrap, он выполняет загрузку конфига, инициализацию компонентов, front контроллера, базы данных и [...]]]></description>
			<content:encoded><![CDATA[<p>С выходом Zend Framework 1.8 связано много новых изменений и дополнений. Самые значительные это добавление Zend_Application и Zend_Tool.</p>
<p>Zend_Tool представляет собой консольную программу управления проектами на Zend Framework.</p>
<p>Zend_Application это новая система загрузки приложения и конфигурирования проекта.</p>
<p>Рассмотрим как работать с Zend_Application подробнее.</p>
<p>Управление загрузкой приложения занимается Zend_Application_Bootstrap, он выполняет загрузку конфига, инициализацию компонентов, front контроллера, базы данных и объекта вида view.</p>
<p>Большинство настроек этих компонентов может храниться в конфигурационном файле, что обеспечивает дополнительную гибкость и модульность.</p>
<p>Я не буду подробно описывать все файлы и параметры в деталях, так как они уже имеют хорошее описание в manual и руководстве quickstart. Вместо этого, создадим простое рабочее приложение с минимальным количеством настроек.</p>
<p>Вы можете просто использовать copy-past приведенных скриптов, чтоб сэкономить время.</p>
<p>Давате создадим файловую структуру.</p>
<div class="igBar"><span id="lphp-36"><a href="#" onclick="javascript:showPlainTxt('php-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-36">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p public/css</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p public/img</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p public/js</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/configs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/controllers</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/layouts/scripts</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/models</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/views/helpers</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/views/scripts/index</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p application/views/scripts/error</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p data/session</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p bin</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p library/App</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p tests/application</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mkdir"><span style="color:#000066;">mkdir</span></a> -p tests/application/controllers </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Теперь скачайте последний релиз ZF и скопируйте директорию Zend в library.</p>
<p><strong>Public каталог</strong></p>
<p>Создайте файл public/.htaccess</p>
<div class="igBar"><span id="lphp-37"><a href="#" onclick="javascript:showPlainTxt('php-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-37">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SetEnv APPLICATION_ENV development</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteEngine On</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color:#006600; font-weight:bold;">&#123;</span>REQUEST_FILENAME<span style="color:#006600; font-weight:bold;">&#125;</span> -s <span style="color:#006600; font-weight:bold;">&#91;</span>OR<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color:#006600; font-weight:bold;">&#123;</span>REQUEST_FILENAME<span style="color:#006600; font-weight:bold;">&#125;</span> -l <span style="color:#006600; font-weight:bold;">&#91;</span>OR<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color:#006600; font-weight:bold;">&#123;</span>REQUEST_FILENAME<span style="color:#006600; font-weight:bold;">&#125;</span> -d</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteRule ^.*$ - <span style="color:#006600; font-weight:bold;">&#91;</span>NC,L<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteRule ^.*$ index.php <span style="color:#006600; font-weight:bold;">&#91;</span>NC,L<span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>В файле public/index.php мы просто установим переменные окружения, а все остальное сделает Zend_Application. Как я упоминал раньше, большинство настроек хранится в конфиграционном файле.</p>
<p>public/index.php</p>
<div class="igBar"><span id="lphp-38"><a href="#" onclick="javascript:showPlainTxt('php-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-38">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/define"><span style="color:#000066;">define</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'BASE_PATH'</span>, <a href="http://www.php.net/realpath"><span style="color:#000066;">realpath</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/dirname"><span style="color:#000066;">dirname</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">'/../'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/define"><span style="color:#000066;">define</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'APPLICATION_PATH'</span>, BASE_PATH . <span style="color:#FF0000;">'/application'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Include path</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/set_include_path"><span style="color:#000066;">set_include_path</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; BASE_PATH . <span style="color:#FF0000;">'/library'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; . PATH_SEPARATOR . <a href="http://www.php.net/get_include_path"><span style="color:#000066;">get_include_path</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Define application environment</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/defined"><span style="color:#000066;">defined</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'APPLICATION_ENV'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; || <a href="http://www.php.net/define"><span style="color:#000066;">define</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'APPLICATION_ENV'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/getenv"><span style="color:#000066;">getenv</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'APPLICATION_ENV'</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <a href="http://www.php.net/getenv"><span style="color:#000066;">getenv</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'APPLICATION_ENV'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000;">'production'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Zend_Application</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Zend/Application.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$application</span> = <span style="color:#000000; font-weight:bold;">new</span> Zend_Application<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; APPLICATION_ENV,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; APPLICATION_PATH . <span style="color:#FF0000;">'/configs/application.ini'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$application</span>-&gt;<span style="color:#006600;">bootstrap</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$application</span>-&gt;<span style="color:#006600;">run</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Конфигурационный файл</strong></p>
<p>application/configs/application.ini: В моем приложении используется 3 базы данных: основная база, база для разработки и база для тестирования, поэтому определение настроек баз данных разделено на 3 разных части.</p>
<div class="igBar"><span id="lphp-39"><a href="#" onclick="javascript:showPlainTxt('php-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-39">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>production<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Debug output</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_startup_errors = <span style="color:#CC66CC;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_errors = <span style="color:#CC66CC;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Include path</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">includePaths.library = APPLICATION_PATH <span style="color:#FF0000;">"/../library"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Bootstrap</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">bootstrap.path = APPLICATION_PATH <span style="color:#FF0000;">"/Bootstrap.php"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">bootstrap.<span style="color:#000000; font-weight:bold;">class</span> = <span style="color:#FF0000;">"Bootstrap"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Front Controller</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.frontController.controllerDirectory = APPLICATION_PATH <span style="color:#FF0000;">"/controllers"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.frontController.env = APPLICATION_ENV</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Layout</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.layout.layout = <span style="color:#FF0000;">"layout"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.layout.layoutPath = APPLICATION_PATH <span style="color:#FF0000;">"/layouts/scripts"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Views</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.view.encoding = <span style="color:#FF0000;">"UTF-8"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.view.basePath = APPLICATION_PATH <span style="color:#FF0000;">"/views/"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Database</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.adapter = <span style="color:#FF0000;">"pdo_mysql"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.host = <span style="color:#FF0000;">"localhost"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.username = <span style="color:#FF0000;">"myproject"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.password = <span style="color:#FF0000;">"myproject"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.dbname = <span style="color:#FF0000;">"myproject_production"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.isDefaultTableAdapter = <span style="color:#000000; font-weight:bold;">true</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Session</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.session.save_path = APPLICATION_PATH <span style="color:#FF0000;">"/../data/session"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.session.remember_me_seconds = <span style="color:#CC66CC;color:#800000;">864000</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>testing : production<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Debug output</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_startup_errors = <span style="color:#CC66CC;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_errors = <span style="color:#CC66CC;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Database</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.dbname = <span style="color:#FF0000;">"myproject_testing"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>development : production<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Debug output</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_startup_errors = <span style="color:#CC66CC;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">phpSettings.display_errors = <span style="color:#CC66CC;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Database</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.db.params.dbname = <span style="color:#FF0000;">"myproject_development"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Загрузчик</strong></p>
<p>application/Bootstrap.php: как определено в конфигурационном файле, приложение использует этот файл для процесса загрузки. Я предоставил Zend_Application выполнить всю инициализацию самостоятельно за исключение вида view. В view я хочу установить особый doctype XHTML.</p>
<div class="igBar"><span id="lphp-40"><a href="#" onclick="javascript:showPlainTxt('php-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-40">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Bootstrap extends Zend_Application_Bootstrap_Bootstrap</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; protected <span style="color:#000000; font-weight:bold;">function</span> _initView<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Initialize view</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$view</span> = <span style="color:#000000; font-weight:bold;">new</span> Zend_View<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$view</span>-&gt;<span style="color:#006600;">doctype</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'XHTML1_STRICT'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$view</span>-&gt;<span style="color:#006600;">headTitle</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'My Project'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$view</span>-&gt;<span style="color:#006600;">env</span> = APPLICATION_ENV;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Add it to the ViewRenderer</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$viewRenderer</span> = Zend_Controller_Action_HelperBroker::<span style="color:#006600;">getStaticHelper</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'ViewRenderer'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$viewRenderer</span>-&gt;<span style="color:#006600;">setView</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$view</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Return it, so that it can be stored by the bootstrap</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$view</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Готово. Это и есть процесс загрузки. Ваше приложение теперь готово использовать ZF MVC и базу данных. Поэтому, давайте продолжим настроку специфических элементов приложения.</p>
<p><strong>Добавим layout</strong></p>
<p>Давайте добвим layout по умолчанию applicaiton/layouts/scripts/layout.phtml:</p>
<div class="igBar"><span id="lphp-41"><a href="#" onclick="javascript:showPlainTxt('php-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-41">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">doctype</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;head&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">headTitle</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">headLink</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">headStyle</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">headScript</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/head&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">layout</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">content</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Добавим контроллер и вид view<br />
</strong></p>
<p>application/controllers/IndexController.php ничего особенного в нем:</p>
<div class="igBar"><span id="lphp-42"><a href="#" onclick="javascript:showPlainTxt('php-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-42">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> IndexController extends Zend_Controller_Action</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> indexAction<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Дабавим view для index/index action в application/view/scripts/index/index.phtml</p>
<div class="igBar"><span id="lphp-43"><a href="#" onclick="javascript:showPlainTxt('php-43'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-43">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1 id=<span style="color:#FF0000;">"welcome-to-the-zend-framework"</span>&gt;Welcome to the Zend Framework!&lt;/h1&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>application/controllers/ErrorController.php вызывается в том случае, если запрашиваемый контроллер не был найден. В зависимости от переменных окружения он вызывает исключение и вывод трассировки стека.</p>
<p>application/controllers/ErrorController.php:</p>
<div class="igBar"><span id="lphp-44"><a href="#" onclick="javascript:showPlainTxt('php-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-44">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> ErrorController extends Zend_Controller_Action</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> errorAction<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$errors</span> = <span style="color:#0000FF;">$this</span>-&gt;_getParam<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_handler'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">switch</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$errors</span>-&gt;<span style="color:#006600;">type</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> Zend_Controller_Plugin_ErrorHandler::<span style="color:#006600;">EXCEPTION_NO_CONTROLLER</span>:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> Zend_Controller_Plugin_ErrorHandler::<span style="color:#006600;">EXCEPTION_NO_ACTION</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 404 error -- controller or action not found</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">getResponse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">setHttpResponseCode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">404</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">view</span>-&gt;<span style="color:#006600;">message</span> = <span style="color:#FF0000;">'Page not found'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">default</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// application error</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">getResponse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">setHttpResponseCode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">500</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">view</span>-&gt;<span style="color:#006600;">message</span> = <span style="color:#FF0000;">'Application error'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">view</span>-&gt;<span style="color:#006600;">exception</span> = <span style="color:#0000FF;">$errors</span>-&gt;<span style="color:#006600;">exception</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">view</span>-&gt;<span style="color:#006600;">request</span>&nbsp; &nbsp;= <span style="color:#0000FF;">$errors</span>-&gt;<span style="color:#006600;">request</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>И принадлежащий ему вид:</p>
<div class="igBar"><span id="lphp-45"><a href="#" onclick="javascript:showPlainTxt('php-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-45">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1 id=<span style="color:#FF0000;">"an-error-occurred"</span>&gt;An error occurred&lt;/h1&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h3 id=<span style="color:#FF0000;">""</span>&gt;&lt;?php <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">message</span> ?&gt;&lt;/h3&gt; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'development'</span> == <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">env</span><span style="color:#006600; font-weight:bold;">&#41;</span>: <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h4 id=<span style="color:#FF0000;">"exception-information"</span>&gt;Exception information:&lt;/h4&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &lt;strong&gt;Message:&lt;/strong&gt; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">exception</span>-&gt;<span style="color:#006600;">getMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/p&gt; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h4 id=<span style="color:#FF0000;">"stack-trace"</span>&gt;Stack trace:&lt;/h4&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;pre&gt;&lt;?php <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">exception</span>-&gt;<span style="color:#006600;">getTraceAsString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/pre&gt; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h4 id=<span style="color:#FF0000;">"request-parameters"</span>&gt;Request Parameters:&lt;/h4&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?</span> <a href="http://www.php.net/var_dump"><span style="color:#000066;">var_dump</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">request</span>-&gt;<span style="color:#006600;">getParams</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Теперь ваше приложение должно работать. Попробуйте открыть / и /foo. Вы должны будете увидеть index/index и error/error actions.</p>
<p><a href="http://maff.ailoo.net/2009/04/set-up-a-zend-framework-application-using-zend_application-including-phpunit-setup/">Сокращено и переведено из mafflog</a>.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/nastraivaem-zend-application">Permalink</a> |
<a href="http://pro100pro.com/nastraivaem-zend-application#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/nastraivaem-zend-application&title=Настраиваем Zend Application">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/bootstrap" rel="tag">bootstrap</a>, <a href="http://pro100pro.com/tag/zend-application" rel="tag">Zend Application</a>, <a href="http://pro100pro.com/tag/zend-bootstrap" rel="tag">Zend Bootstrap</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/nastraivaem-zend-application/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Прикручиваем свои сообщения к Zend Validate Email</title>
		<link>http://pro100pro.com/custom-notifications-zend-validate-email</link>
		<comments>http://pro100pro.com/custom-notifications-zend-validate-email#comments</comments>
		<pubDate>Tue, 11 Aug 2009 14:58:45 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[custom messages]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend mail]]></category>
		<category><![CDATA[zend validate]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=234</guid>
		<description><![CDATA[Валидацией email адресов в ZF занимается Zend_Validate_Email. Кто не знает, email состоит из двух частей, имени и хоста. Хост проверяется с помощью Zend_Validate_Hostname и все эти вещи выполняются в background, т.е. мы не получем каких либо нотификаций о происходящих там процессах.
Так, вот Thomas Weidner разобрался с этой проблемой и предлагает свое решение валидиции email.

© Yaroslav [...]]]></description>
			<content:encoded><![CDATA[<p>Валидацией email адресов в ZF занимается Zend_Validate_Email. Кто не знает, email состоит из двух частей, имени и хоста. Хост проверяется с помощью Zend_Validate_Hostname и все эти вещи выполняются в background, т.е. мы не получем каких либо нотификаций о происходящих там процессах.</p>
<p>Так, вот Thomas Weidner разобрался с этой проблемой и предлагает свое <a href="http://www.thomasweidner.com/flatpress/2009/08/08/validating-emails/">решение валидиции email</a>.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/custom-notifications-zend-validate-email">Permalink</a> |
<a href="http://pro100pro.com/custom-notifications-zend-validate-email#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/custom-notifications-zend-validate-email&title=Прикручиваем свои сообщения к Zend Validate Email">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/custom-messages" rel="tag">custom messages</a>, <a href="http://pro100pro.com/tag/zend-framework" rel="tag">Zend Framework</a>, <a href="http://pro100pro.com/tag/zend-mail" rel="tag">zend mail</a>, <a href="http://pro100pro.com/tag/zend-validate" rel="tag">zend validate</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/custom-notifications-zend-validate-email/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
