<?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>Symfony-IT &#187; tips</title>
	<atom:link href="http://www.symfony.it/categoria/documentazione/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.symfony.it</link>
	<description>Just another Symfony Framework weblog</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:23:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Testare più email contemporaneamente</title>
		<link>http://www.symfony.it/articoli/260/testare-piu-email-contemporaneamente/</link>
		<comments>http://www.symfony.it/articoli/260/testare-piu-email-contemporaneamente/#comments</comments>
		<pubDate>Fri, 28 May 2010 09:38:54 +0000</pubDate>
		<dc:creator>fullo</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sfTestMailer]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=260</guid>
		<description><![CDATA[Può capitare di inviare dalla stessa action diverse email, ad esempio per notificare un amministratore di un determinato evento e contemporaneamente per dare feedback all'utente che l'ha scatenato. In questi casi sfTesterMailer, che con il metodo withMessage(), ci viene incontro dandoci la possibilità di filtrare, filtrando per destinatario, l'email che vogliamo testare. Supponiamo ad esempio [...]]]></description>
			<content:encoded><![CDATA[<p>Può capitare di inviare dalla stessa <code>action</code> diverse email, ad esempio per notificare un amministratore di un determinato evento e contemporaneamente per dare feedback all'utente che l'ha scatenato.</p>
<p>In questi casi <code>sfTesterMailer</code>, che con il metodo <code>withMessage()</code>, ci viene incontro dandoci la possibilità di filtrare, filtrando per destinatario, l'email che vogliamo testare.</p>
<p>Supponiamo ad esempio di aver spedito due email, una a admin@example.org e l'altra ad user@example.org in questo ordine. </p>
<p>Il test funzionale corrispondente sarà:</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;">with<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'mailer'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">begin</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="">hasSent</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&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; <span style="">checkHeader</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'to'</span>, <span style="color:#CC0000;">'/admin@example.org/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="">withMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'user@example.org'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&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; <span style="">checkHeader</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'to'</span>, <span style="color:#CC0000;">'/user@example.org/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">end</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>Inoltre il metodo <code>withMessage()</code> ci permette anche di ciclare all'interno dei messaggi, usando un secondo parametro denominato <code>$position</code>, casomai i messaggi inviati all'utente siano più di uno.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/260/testare-piu-email-contemporaneamente/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deselezionare le opzioni di una select multipla in un test funzionale</title>
		<link>http://www.symfony.it/articoli/162/deselezionare-le-opzioni-di-una-select-multipla-in-un-test-funzionale/</link>
		<comments>http://www.symfony.it/articoli/162/deselezionare-le-opzioni-di-una-select-multipla-in-un-test-funzionale/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 11:06:50 +0000</pubDate>
		<dc:creator>filippo</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[function testing]]></category>
		<category><![CDATA[sfTestBrowser]]></category>
		<category><![CDATA[symfony1.2]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=162</guid>
		<description><![CDATA[Mi è capitato questa mattina di dover fare un test funzionale in cui avevo bisogno di deselezionare una serie di opzioni da una select (all'interno di una form) lasciandone però alcuni selezionati. Guardando sulla documentazione dell'sfTestBrowser ho trovato un metodo per il select e deselect di radiobutton o checkbox. Sfortunatamente non ho trovato un metodo [...]]]></description>
			<content:encoded><![CDATA[<p>Mi è capitato questa mattina di dover fare un test funzionale in cui avevo bisogno di deselezionare una serie di opzioni da una select (all'interno di una form) lasciandone però alcuni selezionati. Guardando sulla documentazione dell'sfTestBrowser ho trovato un metodo per il <a href="http://www.symfony-project.org/api/1_2/sfTestFunctionalBase#method_select">select e deselect di radiobutton o checkbox</a>. Sfortunatamente non ho trovato un metodo per deselezionare le opzioni di una select senza dover <a href="http://www.symfony-project.org/jobeet/1_2/Doctrine/en/11">passare un array in post</a>.</p>
<p>Con il mio "pair" mattutino abbiamo quindi deciso di creare un nuovo metodo che sfruttasse il DOM di una pagina html e che potesse rimuovere la selezione di una opzione dato il nome o l'id della select e il valore dell'option.</p>
<p>Abbiamo aperto anche un <a href="http://trac.symfony-project.org/ticket/6686">ticket sul track di Symfony</a> dove potete trovare il <a href="http://trac.symfony-project.org/attachment/ticket/6686/idDoctrineTestBrowser.class.2.php">nuovo metodo</a> e il <a href="http://trac.symfony-project.org/attachment/ticket/6686/idDoctrineTestBrowserTest.php">test unitario</a> che ne verifica la correttezza!</p>
<p>Buon testing a tutti!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/162/deselezionare-le-opzioni-di-una-select-multipla-in-un-test-funzionale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>group by</title>
		<link>http://www.symfony.it/articoli/121/group-by/</link>
		<comments>http://www.symfony.it/articoli/121/group-by/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 14:17:14 +0000</pubDate>
		<dc:creator>garakkio</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[symfony1.2]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=121</guid>
		<description><![CDATA[Quante volte vi è capitato di dover fare una semplice group by per contare le righe di una tabella raggruppate per una data colonna? Per intenderci, quello che si fa in maniera semplicissima in SQL con PLAIN TEXT CODE: SELECT type,COUNT&#40;*&#41; AS num FROM card GROUP BY type; Purtroppo con Propel la cosa non appare [...]]]></description>
			<content:encoded><![CDATA[<p>Quante volte vi è capitato di dover fare una semplice <em>group by</em> per contare le righe di una tabella raggruppate per una data colonna? Per intenderci, quello che si fa in maniera semplicissima in SQL con</p>
<div class="igBar"><span id="lcode-7"><a href="#" onclick="javascript:showPlainTxt('code-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-7">
<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;">SELECT type,COUNT<span style="color:#006600; font-weight:bold;">&#40;</span>*<span style="color:#006600; font-weight:bold;">&#41;</span> AS num FROM card GROUP BY type; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Purtroppo con Propel la cosa non appare subito immediata. Ecco quindi un prezioso metodo da aggiungere alla vostra classe Peer per poterlo fare in modo semplice. Prima di tutto occorre inserire una nuova proprietà $count nel vostro modello (che nel mio esempio si chiama "Card"), con relativi <em>getter</em> e <em>setter</em>:</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;">protected $count;</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;">public function getCount<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:#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; return $this-&gt;<span style="">count</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;">public function setCount<span style="color:#006600; font-weight:bold;">&#40;</span>$count<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;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; $this-&gt;<span style="">count</span> = $count;</div>
</li>
<li style="font-family: 'Courier 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>Ecco quindi il pezzo forte, in CardPeer (ricordate sempre che va adattato secondo il nome del vostro modello):</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;"><span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * grouped select</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * @param&nbsp; Criteria $c</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * @param&nbsp; string&nbsp; &nbsp;$column</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * @return array</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> */</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;">public static function doSelectGroupBy<span style="color:#006600; font-weight:bold;">&#40;</span>Criteria $c = null, $column<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;">&#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; if <span style="color:#006600; font-weight:bold;">&#40;</span>empty<span style="color:#006600; font-weight:bold;">&#40;</span>$c<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; <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; $c = new Criteria;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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; self::<span style="">addSelectColumns</span><span style="color:#006600; font-weight:bold;">&#40;</span>$c<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; $c-&gt;<span style="">addGroupByColumn</span><span style="color:#006600; font-weight:bold;">&#40;</span>$column<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; $c-&gt;<span style="">addAsColumn</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'cnt'</span>, <span style="color:#CC0000;">'COUNT(*)'</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; $stmt = self::<span style="">doSelectStmt</span><span style="color:#006600; font-weight:bold;">&#40;</span>$c<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; $cards = array<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; while <span style="color:#006600; font-weight:bold;">&#40;</span>$row = $stmt-&gt;<span style="">fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>PDO::<span style="">FETCH_NUM</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;">&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; $card = new Card;</div>
</li>
<li style="font-family: 'Courier 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; $col = $card-&gt;<span style="">hydrate</span><span style="color:#006600; font-weight:bold;">&#40;</span>$row<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; $card-&gt;<span style="">setCount</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>$row<span style="color:#006600; font-weight:bold;">&#91;</span>$col<span style="color:#006600; font-weight:bold;">&#93;</span> !== null<span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#006600; font-weight:bold;">&#40;</span>int<span style="color:#006600; font-weight:bold;">&#41;</span> $row<span style="color:#006600; font-weight:bold;">&#91;</span>$col<span style="color:#006600; font-weight:bold;">&#93;</span> : null<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; $cards<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = $card;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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; return $cards;</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>Ecco infine un esempio di utilizzo:</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;">$cards = CardPeer::<span style="">doSelectGroupBy</span><span style="color:#006600; font-weight:bold;">&#40;</span>null, CardPeer::<span style="">TYPE</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/121/group-by/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>personalizzare i filtri nel backend</title>
		<link>http://www.symfony.it/articoli/101/personalizzare-i-filtri-nel-backend/</link>
		<comments>http://www.symfony.it/articoli/101/personalizzare-i-filtri-nel-backend/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:09:24 +0000</pubDate>
		<dc:creator>garakkio</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[varie]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=101</guid>
		<description><![CDATA[La generazione automatica dei moduli di backend è bellissima, ma a volte c'è da sistemare qualche dettaglio a mano. Un caso esemplare è la form dei filtri, che purtroppo resta in inglese anche se la localizzazione è stata abilitata. Ma con qualche riga aggiuntiva nella classe filter relativa, possiamo metterla facilmente in Italiano (o anche [...]]]></description>
			<content:encoded><![CDATA[<p>La generazione automatica dei moduli di backend è bellissima, ma a volte c'è da sistemare qualche dettaglio a mano. Un caso esemplare è la form dei filtri, che purtroppo resta in inglese anche se la localizzazione è stata abilitata. Ma con qualche riga aggiuntiva nella classe filter relativa, possiamo metterla facilmente in Italiano (o anche personalizzarla ulteriormente). Innanzitutto occorre individuare la classe giusta: se ad esempio il vostro modello si chiama "BlogPost", dovete modificare il file lib/filter/BlogPostFilter.class.php. Aprite dunque il file, ed inserite queste righe all'interno del metodo configure():</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showPlainTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<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;">$this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'created_at'</span><span style="color:#006600; font-weight:bold;">&#93;</span>-&gt;<span style="">setOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'template'</span>, <span style="color:#CC0000;">'da %from_date%&lt;br /&gt; a %to_date%'</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;">$this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'created_at'</span><span style="color:#006600; font-weight:bold;">&#93;</span>-&gt;<span style="">getOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'from_date'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">setOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'format'</span>, <span style="color:#CC0000;">'%day%/%month%/%year%'</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;">$this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'created_at'</span><span style="color:#006600; font-weight:bold;">&#93;</span>-&gt;<span style="">getOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'from_date'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">setOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'empty_values'</span>, array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'year'</span> =&gt; <span style="color:#CC0000;">'anno'</span>, <span style="color:#CC0000;">'month'</span> =&gt; <span style="color:#CC0000;">'mese'</span>, <span style="color:#CC0000;">'day'</span> =&gt; <span style="color:#CC0000;">'giorno'</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;">$this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'created_at'</span><span style="color:#006600; font-weight:bold;">&#93;</span>-&gt;<span style="">getOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'to_date'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">setOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'format'</span>, <span style="color:#CC0000;">'%day%/%month%/%year%'</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;">$this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'created_at'</span><span style="color:#006600; font-weight:bold;">&#93;</span>-&gt;<span style="">getOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'to_date'</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="">setOption</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'empty_values'</span>, array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'year'</span> =&gt; <span style="color:#CC0000;">'anno'</span>, <span style="color:#CC0000;">'month'</span> =&gt; <span style="color:#CC0000;">'mese'</span>, <span style="color:#CC0000;">'day'</span> =&gt; <span style="color:#CC0000;">'giorno'</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>
come si può capire facilmente dal codice, non solo abbiamo messo le etichette in Italiano, ma abbiamo anche invertito l'ordine di mese e anno, portandolo nella forma che ci è più consona.<br />
Ovviamente le opzioni viste sopra si possono applicare anche ad un eventuale campo "updated_at", o a qualsiasi altro campo di tipo data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/101/personalizzare-i-filtri-nel-backend/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sostituire l&#8217;helper &#8220;input_date_tag()&#8221; in Symfony 1.1</title>
		<link>http://www.symfony.it/articoli/40/sostituire-lhelper-input_date_tag-in-symfony-11/</link>
		<comments>http://www.symfony.it/articoli/40/sostituire-lhelper-input_date_tag-in-symfony-11/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 17:03:17 +0000</pubDate>
		<dc:creator>fullo</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[symfony1.1]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=40</guid>
		<description><![CDATA[Come molti di voi avranno appreso, a partire da Symfony 1.1 gli helper javascript (e relativi ai form) sono (imho giustamente) da considerarsi deprecati. Questo perchè rendono la scrittura (ma anche l'utilizzo) del codice più complesso del dovuto stravolgendo (e forzando) logiche non sempre corrette. Tale scelta ha però portato ad alcune mancanze, prima tra [...]]]></description>
			<content:encoded><![CDATA[<p>Come molti di voi avranno appreso, a partire da <a href="http://www.symfony.it/articoli/25/symfony-11-e-il-validation-framework/">Symfony 1.1</a> gli helper javascript (e relativi ai form) sono (imho giustamente) da considerarsi deprecati. Questo perchè rendono la scrittura (ma anche l'utilizzo) del codice più complesso del dovuto stravolgendo (e forzando) logiche non sempre corrette.</p>
<p>Tale scelta ha però portato ad alcune mancanze, prima tra tutte l'impossibilità di definire un behavior <em>rich</em> per quelle form più spesso usate, una per tutte quella delle date.</p>
<p>Un'utile soluzione è quindi quella di includere all'interno della propria applicazione <a href="http://ui.jquery.com/">UI JQuery</a> e nello special modo il modulo <a href="http://ui.jquery.com/functional_demos/#ui.datepicker">datepicker</a>.</p>
<p><span id="more-40"></span></p>
<p>Supponiamo che all'interno della classe che definisce la form del nostro modello esista un widget definito come <code>sfWidgetFormDateTime()</code>. Per sostituire alla scomoda select multipla un calendario javascript dovremmo così agire:</p>
<div class="igBar"><span id="lcode-15"><a href="#" onclick="javascript:showPlainTxt('code-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-15">
<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 EventForm extends BaseEventForm</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; public function configure<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; <span style="color:#006600; font-weight:bold;">&#123;</span>&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; $this-&gt;<span style="">widgetSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'date'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = new sfWidgetFormInput<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; $this-&gt;<span style="">validatorSchema</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'date'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = new sfValidatorDateTime<span style="color:#006600; font-weight:bold;">&#40;</span> array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'with_time'</span> =&gt; false<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;&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;<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>definiamo quindi la vista che mostrerà la nostra form (supponendo di includere nel layout della nostra applicazione <code>jquery.js</code> e <code>ui.js</code>.</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;">&lt;style type=<span style="color:#CC0000;">"text/css"</span>&gt;.<span style="">embed</span> + img <span style="color:#006600; font-weight:bold;">&#123;</span> position: relative; left: -21px; top: -1px; <span style="color:#006600; font-weight:bold;">&#125;</span>&lt;/style&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span>&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;">$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"#event_date"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">datepicker</span><span style="color:#006600; font-weight:bold;">&#40;</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; showOn: <span style="color:#CC0000;">"button"</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; buttonImage: <span style="color:#CC0000;">"/web/images/calendar.gif"</span>, </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; buttonImageOnly: true </div>
</li>
<li style="font-family: 'Courier 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><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">addClass</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"embed"</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;">&lt;/script&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;?php echo $form; ?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>et voilà un bellissimo calendario javascript tornerà a rendere "felici" le nostre applicazioni web 2.0 <img src='http://www.symfony.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/40/sostituire-lhelper-input_date_tag-in-symfony-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editare HTML in una textarea</title>
		<link>http://www.symfony.it/articoli/31/editare-html-in-una-textarea/</link>
		<comments>http://www.symfony.it/articoli/31/editare-html-in-una-textarea/#comments</comments>
		<pubDate>Tue, 20 May 2008 14:12:28 +0000</pubDate>
		<dc:creator>garakkio</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.symfony.it/?p=31</guid>
		<description><![CDATA[Spesso può servire, specialmente se si sta scrivendo un CMS, utilizzare una textarea per l'editing del codice HTML. Purtroppo Symfony, ad ogni submit di una form, converte il contenuto della textarea stessa trasformando le entità HTML nei rispettivi simboli (c'è anche un ticket aperto a riguardo). Questo fastidioso comportamento fa sì che le pagine HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Spesso può servire, specialmente se si sta scrivendo un CMS, utilizzare una textarea per l'editing del codice HTML. Purtroppo Symfony, ad ogni submit di una form, converte il contenuto della textarea stessa trasformando le entità HTML nei rispettivi simboli (c'è anche un <a title="fix_double_escape is sometimes undesiderated" href="http://trac.symfony-project.com/ticket/3503">ticket aperto a riguardo</a>). Questo fastidioso comportamento fa sì che le pagine HTML create in tal modo non siano più validate, perché tutti i vostri "&amp;amp;" diventeranno inesorabilmente "&amp;".</p>
<p>Per ovviare a questo inconveniente, nell'attesa che il ticket sia chiuso, si può usare questo escamotage. Creare una classe, per esempio /lib/fixAmp.class.php</p>
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showPlainTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<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;">&lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class fixAmp</div>
</li>
<li style="font-family: 'Courier 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; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;* fix ampersands in HTML strings</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;* @param&nbsp; string $txt</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;* @return string</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; public static function fixAmps<span style="color:#006600; font-weight:bold;">&#40;</span>$txt<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; <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; $txt = mb_eregi_replace<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'&amp;amp;(?!amp;)'</span>, <span style="color:#CC0000;">'&amp;amp;'</span>, $txt<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; $txt = mb_eregi_replace<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'&amp;amp;#(<span style="color:#000099; font-weight:bold;">\d</span>+);'</span>, <span style="color:#CC0000;">'&amp;#<span style="color:#000099; font-weight:bold;">\1</span>;'</span>, $txt<span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// for numeric entities</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; $txt = mb_eregi_replace<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'&amp;amp;(<span style="color:#000099; font-weight:bold;">\w</span>+);'</span>, <span style="color:#CC0000;">'&amp;<span style="color:#000099; font-weight:bold;">\1</span>;'</span>, $txt<span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// for literal entities</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $txt = mb_eregi_replace<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'&amp;amp;&amp;amp;'</span>, <span style="color:#CC0000;">'&amp;&amp;'</span>, $txt<span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// for php boolean control</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; return $txt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Quindi nella action basterà applicare il metodo al testo ottenuto dalla textarea.<br />
Ad esempio</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showPlainTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<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;">$myClass-&gt;<span style="">setContent</span><span style="color:#006600; font-weight:bold;">&#40;</span>fixAmps::<span style="">fixAmps</span><span style="color:#006600; font-weight:bold;">&#40;</span>$this-&gt;<span style="">getRequestParameter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'content'</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;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La classe vista sopra utilizza mb_eregi_replace() per poter funzionare con i caratteri multi-byte, ma si può facilmente modificare per l'utilizzo con preg_replace()</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/31/editare-html-in-una-textarea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony e Dreamhost</title>
		<link>http://www.symfony.it/articoli/30/symfony-e-dreamhost/</link>
		<comments>http://www.symfony.it/articoli/30/symfony-e-dreamhost/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 17:03:27 +0000</pubDate>
		<dc:creator>fullo</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.symfony.it/articoli/30/symfony-e-dreamhost/</guid>
		<description><![CDATA[Utilizzare Symfony dalla shell con Dreamhost spesso porta a ricevere oscuri errori in console come il seguente: PLAIN TEXT CODE: ~/dh$ php symfony &#160; Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/user/domain.com/data/symfony/bin/symfony.php on line 42 il problema dipende dal fatto che la console dell'hosting provider utilizza php4, [...]]]></description>
			<content:encoded><![CDATA[<p>Utilizzare Symfony dalla shell con <a href="http://www.dreamhost.com/r.cgi?98914">Dreamhost</a> spesso porta a ricevere oscuri errori in console come il seguente:</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;">~/dh$ php symfony</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;">Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or <span style="color:#CC0000;">'}'</span> in /home/user/domain.<span style="">com</span>/data/symfony/bin/symfony.<span style="">php</span> on line <span style="color:#800000;color:#800000;">42</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>il problema dipende dal fatto che la console dell'hosting provider utilizza php4, anche se il vostro dominio funziona con php5.</p>
<p>Per risolverlo la soluzione più semplice è di richiamare staticamente l'interprete di php5 con il seguente percorso</p>
<div class="igBar"><span id="lcode-26"><a href="#" onclick="javascript:showPlainTxt('code-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-26">
<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;">~/dh$ /usr/local/php5/bin/php symfony </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>alternativamente è possibile crearsi un alias modificando il file <code>.bash_profile</code> del vostro utente aggiungendo la seguente riga:</p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showPlainTxt('code-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<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;">alias php5=<span style="color:#CC0000;">'/usr/local/php5/bin/php'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
e richiamando quindi symfony usando la più comoda sintassi:</p>
<div class="igBar"><span id="lcode-28"><a href="#" onclick="javascript:showPlainTxt('code-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-28">
<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;">~/dh$ php5 symfony </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/30/symfony-e-dreamhost/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Svuotare la cache di Symfony da ogni directory del progetto</title>
		<link>http://www.symfony.it/articoli/24/svuotare-la-cache-di-symfony-da-ogni-directory-del-progetto/</link>
		<comments>http://www.symfony.it/articoli/24/svuotare-la-cache-di-symfony-da-ogni-directory-del-progetto/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 16:12:28 +0000</pubDate>
		<dc:creator>fullo</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.symfony.it/articoli/24/svuotare-la-cache-di-symfony-da-ogni-directory-del-progetto/</guid>
		<description><![CDATA[Emiliano ci suggerisce un tips utile se usate linux come piattaforma di sviluppo. Si tratta di un piccolo script che permette di svuotare la cache di Symfony da qualsiasi directory di un progetto. Basta aprire /etc/profile ed inserire al suo interno PLAIN TEXT CODE: alias scc="cd \$(pwd &#124; sed -e \"s#^\(/var/www/[^/]\+\).*#\1#\") &#38;&#38; symfony cc ; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dearchitettura.com">Emiliano</a> ci suggerisce un tips utile se usate linux come piattaforma di sviluppo. Si tratta di un piccolo script che permette di svuotare la cache di Symfony da qualsiasi directory di un progetto.</p>
<p>Basta aprire <code>/etc/profile</code> ed inserire al suo interno</p>
<div class="igBar"><span id="lcode-30"><a href="#" onclick="javascript:showPlainTxt('code-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-30">
<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;">alias scc=<span style="color:#CC0000;">"cd <span style="color:#000099; font-weight:bold;">\$</span>(pwd | sed -e <span style="color:#000099; font-weight:bold;">\"</span>s#^<span style="color:#000099; font-weight:bold;">\(</span>/var/www/[^/]<span style="color:#000099; font-weight:bold;">\+</span><span style="color:#000099; font-weight:bold;">\)</span>.*#<span style="color:#000099; font-weight:bold;">\1</span>#<span style="color:#000099; font-weight:bold;">\"</span>) &amp;&amp; symfony cc ; cd -"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
a questo punto basterà digitare da console scc e se si è in una sottodirectory di un progetto di symfony magicamente la cache si svuoterà (a patto di avere ovviamente i progetti di Symfony in <code>/var/www</code>)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/24/svuotare-la-cache-di-symfony-da-ogni-directory-del-progetto/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>eAccelerator e routing dei metodi</title>
		<link>http://www.symfony.it/articoli/17/eaccelerator-e-routing-dei-metodi/</link>
		<comments>http://www.symfony.it/articoli/17/eaccelerator-e-routing-dei-metodi/#comments</comments>
		<pubDate>Tue, 04 Sep 2007 10:19:19 +0000</pubDate>
		<dc:creator>fullo</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.symfony.it/articoli/17/eaccelerator-e-routing-dei-metodi/</guid>
		<description><![CDATA[Se utilizzate eAccelerator sul vostro server di produzione e con le ultime due versioni di Symfony ottenete strani messaggi di errore relativi al routing dei metodi simili a PLAIN TEXT CODE: Fatal error: Uncaught exception 'sfStopException' in /usr/share/pear/symfony/action/sfAction.class.php:136 Stack trace: #0 /var/www/html/progetto/apps/applicazione/modules/modulo/actions\actions.class.php&#40;19&#41;: sfAction-&#62;forward&#40;'default', 'module'&#41; #1 /usr/share/pear/symfony/action/sfActions.class.php&#40;53&#41;: connectActions-&#62;executeIndex&#40;&#41; #2 /usr/share/pear/symfony/filter/sfExecutionFilter.class.php&#40;115&#41;: sfActions-&#62;execute&#40;&#41; #3 /usr/share/pear/symfony/filter/sfFilterChain.class.php&#40;43&#41;: sfExecutionFilter-&#62;execute&#40;Object&#40;sfFilterChain&#41;&#41; #4 /usr/share/pear/symfony/filter/sfFlashFilter.class.php&#40;50&#41;: [...]]]></description>
			<content:encoded><![CDATA[<p>Se utilizzate <a href="http://eaccelerator.net/">eAccelerator</a> sul vostro server di produzione e con le ultime due versioni di Symfony ottenete strani messaggi di errore relativi al routing dei metodi simili a </p>
<div class="igBar"><span id="lcode-32"><a href="#" onclick="javascript:showPlainTxt('code-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-32">
<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;">Fatal error: </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Uncaught exception <span style="color:#CC0000;">'sfStopException'</span> in /usr/share/pear/symfony/action/sfAction.<span style="">class</span>.<span style="">php</span>:<span style="color:#800000;color:#800000;">136</span> Stack trace: </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#0 /var/www/html/progetto/apps/applicazione/modules/modulo/actions\actions.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">19</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfAction-&gt;<span style="">forward</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'default'</span>, <span style="color:#CC0000;">'module'</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;">#1 /usr/share/pear/symfony/action/sfActions.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">53</span><span style="color:#006600; font-weight:bold;">&#41;</span>: connectActions-&gt;<span style="">executeIndex</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;">#2 /usr/share/pear/symfony/filter/sfExecutionFilter.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">115</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfActions-&gt;<span style="">execute</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;">#3 /usr/share/pear/symfony/filter/sfFilterChain.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">43</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfExecutionFilter-&gt;<span style="">execute</span><span style="color:#006600; font-weight:bold;">&#40;</span>Object<span style="color:#006600; font-weight:bold;">&#40;</span>sfFilterChain<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;">#4 /usr/share/pear/symfony/filter/sfFlashFilter.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">50</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfFilterChain-&gt;<span style="">execute</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;">#5 /usr/share/pear/symfony/filter/sfFilterChain.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">43</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfFlashFilter-&gt;<span style="">execute</span><span style="color:#006600; font-weight:bold;">&#40;</span>Object<span style="color:#006600; font-weight:bold;">&#40;</span>sfFilterChain<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;">#6 /usr/share/pear/symfony/filter/sfCommonFilter.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">29</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfFilterChain-&gt;<span style="">execute</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;">#7 /usr/share/pear/symfony/filter/sfFilterChain.<span style="">class</span>.<span style="">php</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">43</span><span style="color:#006600; font-weight:bold;">&#41;</span>: sfCommonFilter-&gt;<span style="">execute</span><span style="color:#006600; font-weight:bold;">&#40;</span>Object<span style="color:#006600; font-weight:bold;">&#40;</span>sfFilterChain<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;">#8 /usr/share/pear/symfony/filter/sfWebDeb in&nbsp; /usr/share/pear/symfony/action/sfAction.<span style="">class</span>.<span style="">php</span> on line <span style="color:#800000;color:#800000;">136</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>significa che siete incappati in questo <a href="http://eaccelerator.net/ticket/242">scomodo bug</a>.</p>
<p>La soluzione è molto semplice, basta infatti disabilitare il modulo eAccellerator per php o alternativamente limitarsi a bloccarne l'ottimizzazione modificando nel <code>php.ini</code> la direttiva <code>eaccelerator.optimizer = "0"</code> finchè non sarà rilasciata la nuova versione dell'optimizer.</p>
<p>via <a href="http://www.symfony-project.com/forum/index.php/m/33956/">sfForum</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/17/eaccelerator-e-routing-dei-metodi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sfGuard e sfSimpleBlog&#8230; e le chiavi importate.</title>
		<link>http://www.symfony.it/articoli/15/sfguard-e-sfsimpleblog-e-le-chiavi-importate/</link>
		<comments>http://www.symfony.it/articoli/15/sfguard-e-sfsimpleblog-e-le-chiavi-importate/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 12:48:36 +0000</pubDate>
		<dc:creator>giorg</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.symfony.it/articoli/15/sfguard-e-sfsimpleblog-e-le-chiavi-importate/</guid>
		<description><![CDATA[Se stai cercando, su un'installazione fresca di symfony, di far funzionare i due plugin sfGuardPlugin e sfSimpleBlogPlugin ti potrebbe capitare di incorrere nel seguente errore: [...] Attempt to set foreign key to nonexistent table, sf_guard_user [...] soprattutto se stai seguendo la documentazione. Ciò è dovuto probabilmente al fatto che nel tuo propel.ini la seconda riga [...]]]></description>
			<content:encoded><![CDATA[<p>Se stai cercando, su un'installazione fresca di <a href="http://www.symfony-project.com">symfony</a>, di far funzionare i due plugin <a href="http://trac.symfony-project.com/trac/wiki/sfGuardPlugin">sfGuardPlugin</a> e <a href="http://trac.symfony-project.com/trac/wiki/sfSimpleBlogPlugin">sfSimpleBlogPlugin</a> ti potrebbe capitare di incorrere nel seguente errore:</p>
<p><strong>[...] Attempt to set foreign key to nonexistent table, sf_guard_user [...]</strong></p>
<p>soprattutto se stai seguendo la documentazione. Ciò è dovuto probabilmente al fatto che nel tuo propel.ini la seconda riga</p>
<p><strong>propel.packageObjectModel</strong></p>
<p>è impostata a false. Mettila a true, e molto probabilmente, facendo il rebuild del modello, incorrerai in:</p>
<p><strong>Execution of target "om-template" failed for the following reason: /usr/share/php5/symfony/lib/vendor/propel-generator/build-propel.xml:470:1: No package found for database "" in generated-schema.xml. The propel.packageObjectModel property requires the package attribute to be set for each database.</strong></p>
<p>A questo punto controlla che il file schema.yml dentro la cartella config/ del tuo progetto sia vuoto: se lo è, cancella il file, e finalmente comincia a lavorare.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfony.it/articoli/15/sfguard-e-sfsimpleblog-e-le-chiavi-importate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->