<?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>Code Monkey &#187; configuration</title>
	<atom:link href="http://code.klti.de/tag/configuration/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.klti.de</link>
	<description>Random blurps and rants about programming</description>
	<lastBuildDate>Sat, 06 Jun 2009 21:02:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Symfony: selectively replacing application templates with a plugin</title>
		<link>http://code.klti.de/2009/02/15/symfony-selectively-replacing-application-templates-with-a-plugin/</link>
		<comments>http://code.klti.de/2009/02/15/symfony-selectively-replacing-application-templates-with-a-plugin/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 16:54:34 +0000</pubDate>
		<dc:creator>klti</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://code.klti.de/?p=21</guid>
		<description><![CDATA[After many headaches about how the hell I can get symfony to look for a layout or a template in a plugin directory first, so that you can selectively replace default layouts (meaning the ones in the application or module template directory) with versions provided by a specific plugin, I figured out a simple and [...]]]></description>
			<content:encoded><![CDATA[<p>After many headaches about how the hell I can get symfony to look for a layout or a template in a plugin directory first, so that you can selectively replace default layouts (meaning the ones in the application or module template directory) with versions provided by a specific plugin, I figured out a simple and yet elegant solution. It actually took me a few hours of crawling through symfony code to figure out that it all boils down to the application configuration.</p>
<p>Solution: Simply overwrite the directoy getter in the Configuration class of your application and insert your disired location at the front of the array.</p>
<p><code>class MyExampleApplicationConfiguration extends sfApplicationConfiguration<br />
{<br />
[..]<br />
public function getTemplateDirs($moduleName)<br />
{<br />
$dirs = parent::getTemplateDirs($moduleName);<br />
array_unshift($dirs,sfConfig::get('sf_plugins_dir').'/SomePlugin/apps/'.$this-&gt;getApplication().'/modules/'.$moduleName.'/templates');<br />
return $dirs;<br />
}<br />
[...]<br />
}<br />
</code></p>
<p>Do the same thing with getDecoratorDirs() to replace layout files. It even works for I18n, because they too use a function in sfApplicationConfiguration to get their candidate directories.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.klti.de/2009/02/15/symfony-selectively-replacing-application-templates-with-a-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
