<?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; PHP</title>
	<atom:link href="http://pro100pro.com/category/development/php/feed" rel="self" type="application/rss+xml" />
	<link>http://pro100pro.com</link>
	<description>Про PHP, MySQL, Sphinx и Zend Framework, про архитектуру и производителность, про высокие нагрузки и масштабирование</description>
	<lastBuildDate>Thu, 13 Oct 2011 12:58:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<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>Ускоряем PHP с HipHop</title>
		<link>http://pro100pro.com/uskoryaem-php-s-hiphop</link>
		<comments>http://pro100pro.com/uskoryaem-php-s-hiphop#comments</comments>
		<pubDate>Thu, 04 Feb 2010 10:09:01 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[HipHop]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C plus plus]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Zend Engine]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=417</guid>
		<description><![CDATA[Сегодня Facebook анонсировал релиз HipHop. Коротко, что такое HipHop для PHP: HipHop - это компилятор кода PHP в C++. Т.е. он преобразует PHP код в C++ код для дальнейшей компиляции. Это не другой язык. И это не компилятор времени исполнения (JIT). HipHop будет выпущен Facebook под opensource лицензией, под такой же как и основной код [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://developers.facebook.com/news.php?blog=1&amp;story=358">Сегодня Facebook анонсировал релиз HipHop</a>.</p>
<p>Коротко, что такое HipHop для PHP:</p>
<ul>
<li>HipHop - это компилятор кода PHP в C++. Т.е. он преобразует PHP код в C++ код для дальнейшей компиляции. Это не другой язык. И это не компилятор времени исполнения (JIT).</li>
<li>HipHop будет выпущен Facebook под opensource лицензией, под такой же как и основной код PHP. Facebook возлагает надежды, что разработчики улучшать HipHop и расширят его функциональность, таким образом HipHop сможет заменить больший набор функций PHP.</li>
<li>HipHop был одним из проектов в Facebook по улучшению его производительности. Все таки Facebook, второй сайт по объему траффика в интерент и в основном построенный на PHP. HipHop запущен на большинстве LAMP PHP серверах Facebook и в среднем улучшил производительность этих серверов в два раза.</li>
<li>HipHop достигает этого, путем исследования вашего PHP приложения и на его основе строить C++ проект. C++ проект потом компилируется и запускается на собственном веб серврере. Это дает возможность исключить PHP Zend engine и Apache из цепочки.</li>
<li>Учитывая что, некоторые возможности PHP не поддерживаются. Также, дополнения к PHP написанные на C, должны быть переписаны в HipHop C++ дополнения.</li>
<li>Преимущества в скороости HipHop достигаются благодаря статическому анализу, который парсит ваш PHP код ищя пути преобразования динамических частей в статические.<br />
Учитывая это, ваше улучшение производительности, может сильно варьроваться - более структурированный код получить наибольший прирост в производительности.</li>
</ul>
<p>Что значит HipHop для вас:</p>
<ul>
<li>Если ваш проект использует sharing хостинг - то <strong>ничего</strong>.</li>
<li>Если ваш проект использует 2 или менее серверов - то <strong>ничего</strong>.</li>
<li>Если у вас нет выделенного development и deployment окружения и у вас нет разработчика знающего C++ - то <strong>ничего</strong>.</li>
<li>Если вы разработчик open source приложения - то <strong>немного</strong>.</li>
<li>Если вы shared хостинг компания - то <strong>немного</strong>.</li>
<li>Если PHP не bottleneck вашего приложения - то <strong>пока еще ничего</strong>.</li>
<li>Если ваше приложения использует много серверов, и в основном на них работает PHP, а также у вас есть все исходники PHP кода, у вас есть немного знаний C/C++, тогджа ответ <strong>возможно</strong>.</li>
<li>Если вы разрабатываете php framework, то ответ <strong>иногда</strong>.</li>
<li>Если у вас есть сильно-связанные части архитектуры, которые удовлетворяют требованиям выше и эти части слабо связаны (через API) с остальной системой, то ответ <strong>много</strong> <strong>что</strong>.</li>
<li>Если вы обдумываете какой язык выбрать для реализации вашей системы, то ответ <strong>очень много</strong>.</li>
<li>Если вы обдумываете аргумент, переписать весь сайт на другой язык, то <strong>вы потеряли свой аргумент</strong>.</li>
</ul>
<p>Есть очень много языковы возможностей, хороших или плохих, которые PHP должен поддерживать, а HipHop нет. Потому как HipHop уникальное решение, он <strong>никгода</strong> не заменит Zend Engine.</p>
<p>Статья является частичным переводом статьи Terry Chay <a href="http://terrychay.com/article/hiphop-for-faster-php.shtml">Faster PHP fo shizzle—HipHop for PHP</a></p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2010. |
<a href="http://pro100pro.com/uskoryaem-php-s-hiphop">Permalink</a> |
<a href="http://pro100pro.com/uskoryaem-php-s-hiphop#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/uskoryaem-php-s-hiphop&title=Ускоряем PHP с HipHop">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/c-plus-plus" rel="tag">C plus plus</a>, <a href="http://pro100pro.com/tag/facebook" rel="tag">Facebook</a>, <a href="http://pro100pro.com/tag/hiphop" rel="tag">HipHop</a>, <a href="http://pro100pro.com/tag/performance" rel="tag">Performance</a>, <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/zend-engine" rel="tag">Zend Engine</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/uskoryaem-php-s-hiphop/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sphinx Search плагин поиска для WordPress &#8211; поиск с Sphinx Search для начинающих</title>
		<link>http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih</link>
		<comments>http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih#comments</comments>
		<pubDate>Wed, 23 Dec 2009 15:11:56 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sphinx Search]]></category>
		<category><![CDATA[WPSphinx plugin]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=405</guid>
		<description><![CDATA[Два года назад Петр Зайцев из Percona попросил меня написать ему плагин поиска для WordPress используя Spinx Search. Сейчас этот модуль работает на mysqlperformanceblog.com.

Данная статья будет полезна тем кто только начинает знакомится с Sphinx Search. Ее можно использовать  как начальное руководство для написания простого поисковика на Sphinx Search.]]></description>
			<content:encoded><![CDATA[<p>Два года назад Петр Зайцев из <a title="Percona Inc." href="http://www.percona.com" >Percona</a> попросил меня написать ему <a title="плагин поиска для WordPress на Spihnx Search" href="https://launchpad.net/wp-sphinx-plugin" rel="nofollow">плагин поиска для WordPress</a> используя <a title="Sphinx Search" href="http://www.sphinxsearch.com/" rel="nofollow">Spinx Search</a>. Сейчас этот модуль работает на <a title="MySQL Performance Blog" href="http://www.mysqlperformanceblog.com/" rel="nofollow">mysqlperformanceblog.com</a>.</p>
<p>Данная статья будет полезна тем кто только начинает знакомится с Sphinx Search. Ее можно использовать  как начальное руководство для написания простого поисковика на Sphinx Search.</p>
<p>Возможности плагина:</p>
<ul>
<li>Быстрый поиск, ну это и понятно, мы ведь используем Sphinx Search</li>
<li>Возможность использовать расширенный синтаксис поиска (<a href="http://www.sphinxsearch.com/doc.html#extended-syntax" rel="nofollow">http://www.sphinxsearch.com/doc.html#extended-syntax</a>)</li>
<li>Сортировка результатов поиска по дате или по релевантности</li>
<li>Поиск по постам, комментариям или страницам. Это отличает этот плагин от стандартного поиска на WP, который не производит поиск по комментариям и страницам. А также многие другие поисковые плагины не имеют такой возможности.</li>
<li>Есть возможность исключить из результатов поска комментарии, страницы или посты</li>
<li>И многие другие вкусности, про которые вы можете узнать на странице плагина</li>
</ul>
<p>Все это позволяет нам делать Sphinx Search, и сейчас мы разеберем как это реализовано.</p>
<h3>Конфигурационный файл</h3>
<p>В первую очередь нам надо знать как устроен индекс. (sphinx.conf можно найти в каталоге rep/sphinx.conf)</p>
<p>Мы использовали самое простое решение это один монолитный индекс для всех данных: постов, страниц и комментариев. Формируется такой индекс единым SQL запросом, который приводить я тут не буду, он очень длинный и нас сейчас он не интересует (это все таки статья про Spihnx Search, а не про MySQL :) ), но посмотреть его можно в том же sphinx.conf.</p>
<p>Единственное, что нам стоит знать это какие атрибуты у нас есть:</p>
<ul>
<li>comment_ID</li>
<li>post_ID</li>
<li>isPost</li>
<li>isComment</li>
<li>isPage</li>
<li>post_type</li>
<li>date_added</li>
</ul>
<p>Атрибуты isPost, isComment и isPage отвечают за тип источника. date_added содержит дату добавления данных.</p>
<h3>Поиск</h3>
<p>Теперь рассмотрим как делать поиск, фильтрацию и сортировку используя атрибуты.<br />
Пример:</p>
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showPlainTxt('code-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-16">
<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;">if <span style="color:#006600; font-weight:bold;">&#40;</span> empty<span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;<span style="">params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'search_comments'</span><span style="color:#006600; font-weight:bold;">&#93;</span><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; $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">SetFilter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'isComment'</span>, array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</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;"><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; &nbsp; &nbsp; &nbsp; &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;">if <span style="color:#006600; font-weight:bold;">&#40;</span> empty<span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;<span style="">params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'search_pages'</span><span style="color:#006600; font-weight:bold;">&#93;</span><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; $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">SetFilter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'isPage'</span>, array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</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;"><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; &nbsp; &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;">if <span style="color:#006600; font-weight:bold;">&#40;</span> empty<span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;<span style="">params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'search_posts'</span><span style="color:#006600; font-weight:bold;">&#93;</span><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; $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">SetFilter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'isPost'</span>, array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</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;"><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; </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;">if <span style="color:#006600; font-weight:bold;">&#40;</span> $this-&gt;<span style="">params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'search_sortby'</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#CC0000;">'date'</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</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; $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">SetSortMode</span><span style="color:#006600; font-weight:bold;">&#40;</span>SPH_SORT_ATTR_DESC, <span style="color:#CC0000;">'date_added'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<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> else <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; $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">SetSortMode</span><span style="color:#006600; font-weight:bold;">&#40;</span>SPH_SORT_RELEVANCE<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:#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;">$res = $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">Query</span> <span style="color:#006600; font-weight:bold;">&#40;</span> $this-&gt;<span style="">search_string</span>, $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'sphinx_index'</span><span style="color:#006600; font-weight:bold;">&#93;</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></p>
<p>Первое, если один из аттрибутов не установлен, то с помощью SetFilter('isPost', array(0)) мы исключаем его из поиска.<br />
Второе, если пользователь захотел отсортировать результаты по дате добавления, то мы испольязем режим сортировки по атрибуту SetSortMode(SPH_SORT_ATTR_DESC, 'date_added'). По умолчанию данные сортируются по релевантности.<br />
И последнее мы выполняем собственно запрос с помощью метода Query(), первый параметр это запрос введенный пользователем, второй это индекс по которому выполнять поиск.</p>
<h3>Результат поиска</h3>
<p>Результат поиска мы должны обработать следующим образом:</p>
<ul>
<li>Получить найденный идентификационные номера и по ним получить данные</li>
<li>Используя атрибуты isPost, isPage и isComment мы узнаем из какой таблицы получать данные</li>
<li>Потом объединяем полученный результат</li>
<li>И последнее мы выделяем ключевые слова в результата, путем добавления html тэга STRONG вокруг слова.</li>
</ul>
<p>Выделение ключевых слов делает метод BuildExcerpts</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;">$opts = 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; <span style="color:#CC0000;">'limit'</span>&nbsp; =&gt; $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'excerpt_limit'</span><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; &nbsp; <span style="color:#CC0000;">'around'</span> =&gt; $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'excerpt_around'</span><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; &nbsp; <span style="color:#CC0000;">'chunk_separator'</span> =&gt; $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'excerpt_chunk_separator'</span><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; &nbsp; <span style="color:#CC0000;">'after_match'</span> =&gt; $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'excerpt_after_match'</span>.$isTitle<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; &nbsp; <span style="color:#CC0000;">'before_match'</span> =&gt; $this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'excerpt_before_match'</span>.$isTitle<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;"><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; &nbsp; &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;">$excerpts = $this-&gt;<span style="">config</span>-&gt;<span style="">sphinx</span>-&gt;<span style="">BuildExcerpts</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; $post_content,</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:#CC0000;">'main_'</span>.$this-&gt;<span style="">config</span>-&gt;<span style="">admin_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'sphinx_index'</span><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; &nbsp; $this-&gt;<span style="">search_string</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; $opts</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;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>В параметрах этого метода надо указать строку результата в которой надо выделить слова, индекс, запрос и параметы выделения.  В результате мы получем строку с подсвеченными ключевыми словами, которые пристуствовали в запросе.</p>
<p>В итоге как мы видим, написать свой поиск используя Sphinx Search достаточно просто. Если у вас большой блог и вы также хотите получить быстрый и много-функциональный поиск, тогда скачивайте <a href="http://launchpad.net/wp-sphinx-plugin/1.0/1.0/+download/wp-sphinx-plugin-1.0.tar.gz" rel="nofollow">WPSphinx плагин</a> - это бесплатно. :)</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih">Permalink</a> |
<a href="http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih#comments">6 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih&title=Sphinx Search плагин поиска для WordPress &#8211; поиск с Sphinx Search для начинающих">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/plugin" rel="tag">Plugin</a>, <a href="http://pro100pro.com/tag/sphinx-search" rel="tag">Sphinx Search</a>, <a href="http://pro100pro.com/tag/wordpress" rel="tag">wordpress</a>, <a href="http://pro100pro.com/tag/wpsphinx-plugin" rel="tag">WPSphinx plugin</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/sphinx-search-plugin-poiska-dlya-wordpress-sphinx-dlya-nachinaushih/feed</wfw:commentRss>
		<slash:comments>6</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 . [...]]]></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>Плохие практики PHP разработки</title>
		<link>http://pro100pro.com/plohie-praktiki-php-razrabotki</link>
		<comments>http://pro100pro.com/plohie-praktiki-php-razrabotki#comments</comments>
		<pubDate>Fri, 21 Aug 2009 13:02:47 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[anti patterns]]></category>
		<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Worse pratics]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=292</guid>
		<description><![CDATA[Все мы видели паттерны проектирования и слышали про лучшие практики PHP разработки, но есть и темная сторона, наихудшая сторона "практических" примеров, про которые мы узнаем из рассказов коллег или по слухам. Я говорю про плохие практики PHP разработки, про которые написал Chris Cornutt. Короткий список таких практик: Остерегайтесь Неудачников Эта практика может быть особенно опасна, [...]]]></description>
			<content:encoded><![CDATA[<p>Все мы видели паттерны проектирования и слышали про лучшие практики PHP разработки, но есть и темная сторона, наихудшая сторона "практических" примеров, про которые мы узнаем из рассказов коллег или по слухам. Я говорю про плохие практики PHP разработки, про которые <a href="http://blog.phpdeveloper.org/?p=173">написал</a> Chris Cornutt.</p>
<p>Короткий список таких практик:</p>
<p><strong>Остерегайтесь Неудачников</strong></p>
<p>Эта практика может быть особенно опасна, если вы не будете осторожны.  Часто разработчик смотря на чужой, а иногда и на свой код, уже начал думать, что может переписать его лучше. Остерегайтесь таких программистов, зачастую переписать код не лучший выбор.</p>
<p>Полюбите читать чужой код, Open Source дает разработчикам обмениваться опытом и идеями, что в свою очередь ведет к существенному улучшению программного обеспечения и повышения квалификации программистов.</p>
<p><strong>Не запланированность</strong></p>
<p>Если вы сразу же начинаете разработку нового проекта или модуля написанием кода, ни на секунду не подумав о его структуре, то вы рискуете сорвать проект и сроки. Вы через месяц работы не сможете разобраться и понять, что было написано в начале. Вы можете потерять доверие к себе как к профессионалу среди коллег, так никто не захочет поддерживать ваш код. Будьте внимательны в создании кода, предлагаю вам использовать такую мантру: "Сначала планирование, потом код".</p>
<p>Планирование это хорошая штука, хотя это может показаться вам нудной работой, но не забывайте, что за планирование и кодирование отвечают разные полушария мозга и ой как тяжело переключаться между ними. Поэтому сначала планируйте, а потом кодируйте.</p>
<p><strong>Документация потеря времени</strong></p>
<p>Те кто говорят, что код само-документируемый обманывают сами себя, ведь все мы знаем, что это в большинстве случаев не так. Программирование настолько интересная штука, что мы можем написать тонну кода, без единого комментария. Заставьте себя писать документацию, представьте, что это ваша работа. Создавая код без документации погубит вас, и возможно тех кто будет его поддерживать в будущем. Несколько строчек комментариев о параметрах и возвращаемом значении функций, и phpDocumentator создаст вам отличную документацию, которая поможет решить множество проблем. Вы будете очень удивлены как много раз вам понадобиться обращаться к своей (чужой) документации.</p>
<p><strong>Освободите свой разум</strong></p>
<p>Очень легко работать с тем, что вы сейчас используете и фокусироваться на этих технологиях.  Вы используете ваш код так, как он позволяет, и думаете, что это единственный способ. Но вы ошибаетесь. Вы как разработчик, должны знать, что есть множество путей как решить одну проблему.  Запомните это и используйте все технологии с которыми PHP может работать.</p>
<p>Используйте Zend Framework и Cake-PHP они дадут вам замечательные идеи и готовые компоненты с отличной структурой.</p>
<p><strong>Заключение</strong></p>
<p>Это только несколько ошибок, но их намного, намного больше, которые можно добавить в этот список. Мы как разработчики всегда будем попадаться на эти плохие практики, так как это обычно самый легкий путь.</p>
<p>Фокусируясь на лучших практиках, это самый лучший способ делать код лучше и гибче.</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/plohie-praktiki-php-razrabotki">Permalink</a> |
<a href="http://pro100pro.com/plohie-praktiki-php-razrabotki#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/plohie-praktiki-php-razrabotki&title=Плохие практики PHP разработки">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/anti-patterns" rel="tag">anti patterns</a>, <a href="http://pro100pro.com/tag/php-development" rel="tag">PHP Development</a>, <a href="http://pro100pro.com/tag/worse-pratics" rel="tag">Worse pratics</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/plohie-praktiki-php-razrabotki/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>PHP без PHP</title>
		<link>http://pro100pro.com/php-without-php</link>
		<comments>http://pro100pro.com/php-without-php#comments</comments>
		<pubDate>Sat, 15 Aug 2009 07:30:31 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Paradigms]]></category>
		<category><![CDATA[PHP Architecture]]></category>
		<category><![CDATA[PHP Patterns]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=262</guid>
		<description><![CDATA[Tarry Chay написал интересный пост для PHP Advent, в котором он делиться мыслями про: Умное кеширование или ErrorDocument trick, реализованное на php.net Архитектурные принципы PHP Паттерны проектирования Парадигмы Приводит очень поучительные примеры проектов из жизни, в стиле Стива Макконнелла и Мартина Флауэра А также говорит о том, что Стив Макконнелл в своей книге Code Complete, [...]]]></description>
			<content:encoded><![CDATA[<p>Tarry Chay написал <a href="http://phpadvent.org/2008/php-without-php-by-terry-chay" rel="nofollow">интересный пост</a> для PHP Advent, в котором он делиться мыслями про:</p>
<ul>
<li>Умное кеширование или ErrorDocument trick, реализованное на php.net</li>
<li>Архитектурные принципы PHP</li>
<li>Паттерны проектирования</li>
<li>Парадигмы</li>
<li>Приводит очень поучительные примеры проектов из жизни, в стиле Стива Макконнелла и Мартина Флауэра</li>
<li>А также говорит о том, что Стив Макконнелл в своей книге Code Complete, ошибался насчет парадигмы конструирования</li>
</ul>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/php-without-php">Permalink</a> |
<a href="http://pro100pro.com/php-without-php#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/php-without-php&title=PHP без PHP">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/paradigms" rel="tag">Paradigms</a>, <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/php-architecture" rel="tag">PHP Architecture</a>, <a href="http://pro100pro.com/tag/php-patterns" rel="tag">PHP Patterns</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/php-without-php/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>Список полезных классов и библиотек для PHP разработчиков</title>
		<link>http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky</link>
		<comments>http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky#comments</comments>
		<pubDate>Wed, 12 Aug 2009 18:37:01 +0000</pubDate>
		<dc:creator>Yaroslav Vorozhko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[php classes]]></category>
		<category><![CDATA[php libs]]></category>

		<guid isPermaLink="false">http://pro100pro.com/?p=236</guid>
		<description><![CDATA[Saud Khan из w3avenue собрал хороший список полезных библиотек и классов для PHP разработчиков. Особенно полезным список будет для начинающих. Хотя возможно найдутся некоторые guru PHP, которые не слышали об одной или нескольких перечисленных библиотеках. Список включает в себя следующие разделы: Базы данных Разработка Документация Email Формы HTML/CSS Image/Media/File Javascript/Ajax Microformats RSS &#38; Atom Feeds [...]]]></description>
			<content:encoded><![CDATA[<p>Saud Khan из w3avenue собрал хороший <a href="http://www.w3avenue.com/2009/08/11/really-useful-classes-and-libraries-for-php-developers/">список полезных библиотек и классов для PHP разработчиков</a>.</p>
<p>Особенно полезным список будет для начинающих.</p>
<p>Хотя возможно найдутся некоторые guru PHP, которые не слышали об одной или нескольких перечисленных библиотеках.</p>
<p>Список включает в себя следующие разделы:</p>
<ul>
<li>Базы данных</li>
<li>Разработка</li>
<li>Документация</li>
<li>Email</li>
<li>Формы</li>
<li>HTML/CSS</li>
<li>Image/Media/File</li>
<li>Javascript/Ajax</li>
<li>Microformats</li>
<li>RSS &amp; Atom Feeds</li>
<li>Безопасность</li>
<li>Тестирование и отладка</li>
<li>Веб сервисы</li>
</ul>
<p>В общем хорошая подборка практически на все нужды разработки.</p>
<p>Не поленитесь изучить! ;-)</p>
<hr />
<p><small>© Yaroslav Vorozhko  for <a href="http://pro100pro.com">Просто про веб технологии</a>, 2009. |
<a href="http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky">Permalink</a> |
<a href="http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky&title=Список полезных классов и библиотек для PHP разработчиков">del.icio.us</a>
<br/>
Post tags: <a href="http://pro100pro.com/tag/php" rel="tag">PHP</a>, <a href="http://pro100pro.com/tag/php-classes" rel="tag">php classes</a>, <a href="http://pro100pro.com/tag/php-libs" rel="tag">php libs</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://pro100pro.com/spisok-classov-i-bibliotek-php-razrabotky/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

