<?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"
	>

<channel>
	<title>Tery Blog</title>
	<atom:link href="http://blog.terysoftware.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.terysoftware.com</link>
	<description>El blog de Tery Software</description>
	<pubDate>Fri, 12 Jun 2009 16:12:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Shoutbox en Drupal 5.x</title>
		<link>http://blog.terysoftware.com/2009/06/shoutbox-en-drupal-5x/</link>
		<comments>http://blog.terysoftware.com/2009/06/shoutbox-en-drupal-5x/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 16:12:43 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Drupal 5]]></category>

		<category><![CDATA[Drupal API]]></category>

		<category><![CDATA[Drupal Forms]]></category>

		<category><![CDATA[MiniChat]]></category>

		<category><![CDATA[Shoubox]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=93</guid>
		<description><![CDATA[Una de las aplicaciones que resultan útiles en algunos portales es la creación de bloques de minichat o shoutbox. Son mensajes cortos que se envían a fin de debatir temas cortos o dar informaciones rápidas al usuario.
En drupal existe un módulo para implementar un Shoutbox en un sitio web. Es realmente útil y personalizable, sin [...]]]></description>
			<content:encoded><![CDATA[<p>Una de las aplicaciones que resultan útiles en algunos portales es la creación de bloques de minichat o shoutbox. Son mensajes cortos que se envían a fin de debatir temas cortos o dar informaciones rápidas al usuario.</p>
<p>En drupal existe un módulo para implementar un <a title="Ir a la web del proyecto Shoutbox en Drupal.org" href="http://drupal.org/project/shoutbox" target="_blank">Shoutbox</a> en un sitio web. Es realmente útil y personalizable, sin embargo nosotros hicimos ligeros ajustes al módulo a fin de arreglar dos inconvenientes.</p>
<p><strong>1. El campo de ingreso para el mensaje es de una sola línea</strong>, para el usuario es deseable enviar mensajes más largos. Para ello viene bien valerse del <a title="Ir al artículo" href="http://drupal.org/node/270871" target="_blank">artículo</a> publicado dentro de la pagina de parches pendientes del proyecto. Se pueden hacer los siguientes cambios y reemplazar el campo de texto por un área de texto.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//En la línea 525 Cambiar</span>
<span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'textfield'</span><span style="color: #339933;">,</span>
    <span style="">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$default_msg</span><span style="color: #339933;">,</span>
    <span style="">'#size'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;
<span style="color: #666666; font-style: italic;">//Por:</span>
 <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'textarea'</span><span style="color: #339933;">,</span>   
    <span style="">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$default_msg</span><span style="color: #339933;">,</span>
    <span style="">'#cols'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span>
    <span style="">'#rows'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;</pre></div></div>

<p><strong>2. Para evitar que los usuarios puedan enviar mensajes con cualquier nombre de usuario</strong>, deshabilitamos la edición del campo nick, empleando la propiedad enunciada en el API <a href="http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/5#disabled" target="_blank" title="Ver la propiedad en la web del API de Drupal">#disabled</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//En la línea 517, agregamos al arreglo ('#disabled' =&gt; TRUE,) quedaría de esta forma:</span>
    <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'nick'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'textfield'</span><span style="color: #339933;">,</span>
      <span style="">'#disabled'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span>
      <span style="">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$last_nick</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$last_nick</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$default_nick</span><span style="color: #339933;">,</span>
      <span style="">'#size'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span>
      <span style="">'#maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Por supuesto siempre se podrán aplicar otro tipo de soluciones, como por ejemplo evitar que el campo de Nick sea renderizado empleando la propiedad #access. El módulo es altamente personalizable, recomendado como buena alternativa para un minichat.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/06/shoutbox-en-drupal-5x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Módulos útiles para SEO en Drupal</title>
		<link>http://blog.terysoftware.com/2009/05/modulos-utiles-para-seo-en-drupal/</link>
		<comments>http://blog.terysoftware.com/2009/05/modulos-utiles-para-seo-en-drupal/#comments</comments>
		<pubDate>Sun, 10 May 2009 23:45:03 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=91</guid>
		<description><![CDATA[Cuando se construye una solución web, uno de los temas que más interesan y de gran relevancia es la labor de posicionamiento. Drupal, tiene una serie de módulos que pueden ayudar en esta labor y a manera de resumen quiero compartir estos:
XML Sitemaps: Este módulo, se encarga de la generación automática de mapas de sitio [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando se construye una solución web, uno de los temas que más interesan y de gran relevancia es la labor de posicionamiento. Drupal, tiene una serie de módulos que pueden ayudar en esta labor y a manera de resumen quiero compartir estos:</p>
<p><a href="http://drupal.org/project/xmlsitemap">XML Sitemaps:</a> Este módulo, se encarga de la generación automática de mapas de sitio XML para motores de búsqueda. No solo genera el mapa XML, como añadido, los envía cada vez que el contenido cambia o se ejecuta Cron.</p>
<p><a href="http://drupal.org/project/nodewords">NodeWords:</a> Su principal funcionalidad es ayudar con el metaetiquetado del sitio. Este módulo permite la creación de description y keywords que pueden ser declaradas de manera global, por término o por nodo.</p>
<p><a href="http://drupal.org/project/linkchecker">LinksChecker:</a> Interesante módulo que chequea el sitio a fin de saber si hay enlaces rotos en algún lugar. Útil para evitar la perdida de usuarios y de pagerank.</p>
<p><a href="http://drupal.org/project/path_redirect">PathRedirect:</a> Útil para migraciones de contenido o cambios en la URL. Este módulo se encarga de lo necesario para que las rutas y url queden correctamente redireccionadas.</p>
<p>Es solo un corto resumen seguro que hay más. ¿ Conoces algún otro ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/05/modulos-utiles-para-seo-en-drupal/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Código PHP en Blogger, formateando tu código</title>
		<link>http://blog.terysoftware.com/2009/05/codigo-php-en-blogger-formateando-tu-codigo/</link>
		<comments>http://blog.terysoftware.com/2009/05/codigo-php-en-blogger-formateando-tu-codigo/#comments</comments>
		<pubDate>Sat, 09 May 2009 05:18:50 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Blogger]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Código]]></category>

		<category><![CDATA[formateado]]></category>

		<category><![CDATA[formated]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[Script]]></category>

		<category><![CDATA[well]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=85</guid>
		<description><![CDATA[
Casualmente hoy tuve la necesidad de insertar código PHP en mi blogger, me sorprendió el hecho de que no existiera algún tipo de etiqueta (o no a primera vista) para insertar código y que fuese formateado automáticamente.  Googleando un poco me encontré con un blog (web2development) donde el autor comentaba una posible solución con [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ilearntechnology.com/wordpress/wp-content/uploads/2007/10/blogger.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img class="alignleft" style="border: 0pt none; margin: 0pt 20px 10px; cursor: pointer; width: 138px; height: 103px;" src="http://ilearntechnology.com/wordpress/wp-content/uploads/2007/10/blogger.png" border="0" alt="" width="86" height="65" /></a></p>
<div style="text-align: justify;">Casualmente hoy tuve la necesidad de insertar código PHP en mi blogger, me sorprendió el hecho de que no existiera algún tipo de etiqueta (o no a primera vista) para insertar código y que fuese formateado automáticamente.  Googleando un poco me encontré con un blog (<a href="http://web2development.blogspot.com/2007/05/publicar-codigo-php-en-blogger.html">web2development</a>) donde el autor comentaba una posible solución con un script que el mismo generó. Sin embargo era necesario que ver el código fuente una vez corrido el script para obtener finalmente el resultado (script formateado). Realicé unas pequeñas mejoras al script y decidí alojarlo en nuestro servidor para que sirva como herramienta para mí y quien lo necesite.  Puedes emplear el siguiente enlace para formatear tus códigos en PHP (Inicialmente PHP, quisiera más adelante añadir para otros lenguajes).  <a href="http://formatealo.terysoftware.com/">Formatea Tu Código</a> No estaría completo este post si no incluyera el código del script con las modificaciones que realicé. Básicamente el script imprime el resultado en un div aparte; también preferí insertar un salto en html en la línea quince (15). Se agregaron algunas lineas para cambiar los caracteres que causaban conflictos. Almacené temporalmente el resultado del script en un archivo para luego obtener directamente su código fuente y generarlo para uso del usuario.</div>
<p><code><strong>1</strong> <span style="color: #000000;"> &lt;!&#8212; Form for code &#8211;&gt; <strong></strong></span></code></p>
<p><code><span style="color: #000000;"><strong>2</strong> &lt;form action=&#8221;<span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$_SERVER</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'PHP_SELF'</span><span style="color: #007700;">]; </span><span style="color: #0000bb;">?&gt;</span>&#8221; method=&#8221;post&#8221; style=&#8221;margin-bottom: 40px;&#8221;&gt;&lt;div id=&#8221;formulario&#8221;&gt; </span></code></p>
<p><code><span style="color: #000000;"><strong>3</strong> &lt;textarea rows=&#8221;20&#8243; cols=&#8221;80&#8243; name=&#8221;codigo&#8221;&gt;&lt;/textarea&gt;&lt;br /&gt; <strong></strong></span></code></p>
<p><code><span style="color: #000000;"><strong>4</strong> &lt;input type=&#8221;submit&#8221; name=&#8221;enviar&#8221; value=&#8221;Formatear&#8221; /&gt;&lt;/div&gt; </span></code></p>
<p><code><span style="color: #000000;"><strong>5</strong> &lt;/form&gt; </span></code></p>
<p><code><span style="color: #000000;"><strong>6</strong> <span style="color: #0000bb;">&lt;?php <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #0000bb;"><strong>7</strong> </span><span style="color: #007700;">if( !empty( </span><span style="color: #0000bb;">$_POST</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'codigo'</span><span style="color: #007700;">] ) ) { <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>8</strong> </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$_POST</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'codigo'</span><span style="color: #007700;">]; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>9</strong> </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">= </span><span style="color: #0000bb;">str_replace</span><span style="color: #007700;">( </span><span style="color: #dd0000;">&#8220;\t&#8221;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8221;     &#8220;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">); <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>10</strong> </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">= </span><span style="color: #0000bb;">highlight_string</span><span style="color: #007700;">( </span><span style="color: #0000bb;">stripslashes</span><span style="color: #007700;">( </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">), </span><span style="color: #0000bb;">true </span><span style="color: #007700;">); <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>11</strong> <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>12</strong> </span><span style="color: #0000bb;">$line </span><span style="color: #007700;">= </span><span style="color: #0000bb;">1</span><span style="color: #007700;">; </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>13</strong> </span><span style="color: #0000bb;">$buffer </span><span style="color: #007700;">= array(); </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>14</strong> </span><span style="color: #0000bb;">$cod </span><span style="color: #007700;">= </span><span style="color: #0000bb;">explode</span><span style="color: #007700;">( </span><span style="color: #dd0000;">&#8220;&lt;br /&gt;&#8221;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">); <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>15</strong> foreach( </span><span style="color: #0000bb;">$cod </span><span style="color: #007700;">as </span><span style="color: #0000bb;">$codLine </span><span style="color: #007700;">) { </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>16</strong> </span><span style="color: #0000bb;">$buffer</span><span style="color: #007700;">[] = </span><span style="color: #dd0000;">&#8220;&lt;b&gt;$line&lt;/b&gt;&amp;nbsp;&amp;nbsp;&#8221; </span><span style="color: #007700;">. </span><span style="color: #0000bb;">$codLine</span><span style="color: #007700;">; </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>17</strong> </span><span style="color: #0000bb;">$line</span><span style="color: #007700;">++; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>18</strong> } <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>19</strong> <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>20</strong> </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">= </span><span style="color: #0000bb;">implode</span><span style="color: #007700;">( </span><span style="color: #dd0000;">&#8220;&lt;br /&gt;&#8221;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$buffer </span><span style="color: #007700;">); <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>21</strong> </span><span style="color: #ff8000;">// HACK: </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #ff8000;"><strong>22</strong> </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">= </span><span style="color: #0000bb;">str_replace</span><span style="color: #007700;">( </span><span style="color: #dd0000;">&#8220;&lt;b&gt;1&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;&#8221;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8220;&lt;code&gt;&lt;b&gt;1&lt;/b&gt;&amp;nbsp;&amp;nbsp;&#8221;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$codigo </span><span style="color: #007700;">); </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>23</strong> echo </span><span style="color: #dd0000;">&#8216;&lt;div id=&#8221;formated&#8221; style=&#8221;border: double #dfdfdf;&#8221;&gt;&lt;h3&gt; Este es tu código formateado &lt;/h3&gt;&#8217;</span><span style="color: #007700;">; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>24</strong> echo </span><span style="color: #dd0000;">&#8216;&lt;p&gt;&#8217;</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$codigo</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8216;&lt;/p&gt;&lt;hr /&gt;&#8217;</span><span style="color: #007700;">; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>25</strong> </span><span style="color: #ff8000;">//Gets the source from a file previously created and modified <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #ff8000;"><strong>26</strong> </span><span style="color: #0000bb;">$abrir</span><span style="color: #007700;">=</span><span style="color: #0000bb;">fopen</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8220;tmp.txt&#8221;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8220;w&#8221;</span><span style="color: #007700;">); </span><span style="color: #ff8000;">//open file <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #ff8000;"><strong>27</strong> </span><span style="color: #0000bb;">fwrite</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$abrir</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$codigo</span><span style="color: #007700;">); </span><span style="color: #ff8000;">//save code obtained previously <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #ff8000;"><strong>28</strong> </span><span style="color: #0000bb;">fclose</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$abrir</span><span style="color: #007700;">); </span><span style="color: #ff8000;">//close file <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #ff8000;"><strong>29</strong> </span><span style="color: #0000bb;">$url </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8216;http://formatealo.terysoftware.com/tmp.txt&#8217;</span><span style="color: #007700;">; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>30</strong> </span><span style="color: #0000bb;">$lineas </span><span style="color: #007700;">= </span><span style="color: #0000bb;">file</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$url</span><span style="color: #007700;">); </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>31</strong> for (</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">count</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$lineas</span><span style="color: #007700;">); </span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) { <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>32</strong> </span><span style="color: #0000bb;">$resultado </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$resultado</span><span style="color: #007700;">.</span><span style="color: #0000bb;">htmlentities</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$lineas</span><span style="color: #007700;">[</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">]).</span><span style="color: #dd0000;">&#8220;&lt;br /&gt;&#8221;</span><span style="color: #007700;">; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>33</strong> } </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>34</strong> <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>35</strong> echo </span><span style="color: #dd0000;">&#8216;&lt;h3&gt;Inserta este código en tu sitio &lt;/h3&gt;&#8217;</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$resultado</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8216;&lt;/div&gt;&#8217;</span><span style="color: #007700;">; </span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>36</strong> } <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #007700;"><strong>37</strong> </span><span style="color: #0000bb;">?&gt; <strong></strong></span></span></code></p>
<p><code><span style="color: #000000;"><span style="color: #0000bb;"><strong>38</strong> </span></span></code></p>
<p><code><span style="color: #000000;"> <strong>39</strong> &lt;/div&gt; </span></code></p>
<div style="text-align: justify;">Sin duda se pueden mejorar algunas cosas, espero alguien pueda ayudar a mejorar el código. Los recursos empleados fueron:  <a href="http://www.php.net/manual/es/function.fopen.php">http://www.php.net/manual/es/function.fopen.php</a> <a href="http://www.php.net/htmlentities">http://www.php.net/htmlentities</a> <a href="http://informatica-practica.net/solocodigo/index.php/2007/12/27/mostrar-codigo-fuente-de-una-pagina-con-php/">http://informatica-practica.net/solocodigo/index.php/2007/12/27/mostrar-codigo-fuente-de-una-pagina-con-php/</a> <a href="http://web2development.blogspot.com/2007/05/publicar-codigo-php-en-blogger.html">web2development</a> El código formateado puedes pegarlo sin inconveniente en el editor por default que trae el blogger. Si tienes algún script que realice la misma función para otros lenguajes podríamos publicarlo también. Valga mencionar que al publicar obtengo un error de TAGS no vaĺidos, por lo que marco el check para que deje de verificar el post actual.  Fuente: <a href="http://desarrolladoryempresario.blogspot.com/2009/05/codigo-php-en-blogger-formateando-tu_08.html" target="_blank">http://desarrolladoryempresario.blogspot.com/2009/05/codigo-php-en-blogger-formateando-tu_08.html</a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/05/codigo-php-en-blogger-formateando-tu-codigo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Drupal 5 - Corregir error de validación XHTML por id &#8220;edit-submit&#8221;</title>
		<link>http://blog.terysoftware.com/2009/03/drupal-5-corregir-error-de-validacion-xhtml-por-id-edit-submit/</link>
		<comments>http://blog.terysoftware.com/2009/03/drupal-5-corregir-error-de-validacion-xhtml-por-id-edit-submit/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 21:24:22 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[Drupal 5]]></category>

		<category><![CDATA[PHPTemplate]]></category>

		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=77</guid>
		<description><![CDATA[Drupal 5 presenta un error al validar con estandar XHTML dependiendo del template que se emplee. Por defecto drupal no alterna los identificadores de los diversos inputs que puedan haber en una misma página; por lo que se presenta un error de id duplicado en la validación.
Para solucionar dicho inconveniente pueden agregarse las siguientes lineas [...]]]></description>
			<content:encoded><![CDATA[<p>Drupal 5 presenta un error al validar con estandar XHTML dependiendo del template que se emplee. Por defecto drupal no alterna los identificadores de los diversos inputs que puedan haber en una misma página; por lo que se presenta un error de id duplicado en la validación.</p>
<p>Para solucionar dicho inconveniente pueden agregarse las siguientes lineas al archivo template.php ya sea del engine o del theme.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #0000ff; font-style: italic;">/**
* Arregla la duplicación de id's &quot;edit-sumit&quot;.
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> phptemplate_submit<span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">static</span> <span style="color: #000088;">$dupe_ids</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dupe_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$dupe_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span>++;
    <span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="">'-'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$dupe_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$dupe_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$element</span><span style="color: #009900;">&#91;</span><span style="">'#id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> theme<span style="color: #009900;">&#40;</span><span style="">'button'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/03/drupal-5-corregir-error-de-validacion-xhtml-por-id-edit-submit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Detectar navegador usando PHP.</title>
		<link>http://blog.terysoftware.com/2009/03/detectar-navegador-usando-php/</link>
		<comments>http://blog.terysoftware.com/2009/03/detectar-navegador-usando-php/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 04:48:36 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Navegadores]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=73</guid>
		<description><![CDATA[Muchas veces es bastante útil el detectar el navegador que usa el cliente que se conecta a fin de saber si soporta ciertas funcionalidades o simplemente para hacerle cargar una hoja de estilos diferente. Se puede hacer a través de html, sin embargo una manera elegante de hacerlo es haciendo uso de PHP. Para esto, [...]]]></description>
			<content:encoded><![CDATA[<p>Muchas veces es bastante útil el detectar el navegador que usa el cliente que se conecta a fin de saber si soporta ciertas funcionalidades o simplemente para hacerle cargar una hoja de estilos diferente. Se puede hacer a través de html, sin embargo una manera elegante de hacerlo es haciendo uso de PHP. Para esto, podemos escribir una función que nos detecte el navegador cliente.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> ObtenerNavegador<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_agent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$navegadores</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="">'Opera'</span> <span style="color: #339933;">=&gt;</span> <span style="">'Opera'</span><span style="color: #339933;">,</span>
          <span style="">'Mozilla Firefox'</span><span style="color: #339933;">=&gt;</span> <span style="">'(Firebird)|(Firefox)'</span><span style="color: #339933;">,</span>
          <span style="">'Galeon'</span> <span style="color: #339933;">=&gt;</span> <span style="">'Galeon'</span><span style="color: #339933;">,</span>
          <span style="">'Mozilla'</span><span style="color: #339933;">=&gt;</span><span style="">'Gecko'</span><span style="color: #339933;">,</span>
          <span style="">'MyIE'</span><span style="color: #339933;">=&gt;</span><span style="">'MyIE'</span><span style="color: #339933;">,</span>
          <span style="">'Lynx'</span> <span style="color: #339933;">=&gt;</span> <span style="">'Lynx'</span><span style="color: #339933;">,</span>
          <span style="">'Netscape'</span> <span style="color: #339933;">=&gt;</span> <span style="">'(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)'</span><span style="color: #339933;">,</span>
          <span style="">'Konqueror'</span><span style="color: #339933;">=&gt;</span><span style="">'Konqueror'</span><span style="color: #339933;">,</span>
          <span style="">'IE7'</span> <span style="color: #339933;">=&gt;</span> <span style="">'(MSIE 7\.[0-9]+)'</span><span style="color: #339933;">,</span>
          <span style="">'IE6'</span> <span style="color: #339933;">=&gt;</span> <span style="">'(MSIE 6\.[0-9]+)'</span><span style="color: #339933;">,</span>
          <span style="">'IE5'</span> <span style="color: #339933;">=&gt;</span> <span style="">'(MSIE 5\.[0-9]+)'</span><span style="color: #339933;">,</span>
          <span style="">'IE4'</span> <span style="color: #339933;">=&gt;</span> <span style="">'(MSIE 4\.[0-9]+)'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span>;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$navegadores</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$navegador</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$pattern</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: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pattern</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_agent</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
       <span style="color: #b1b100;">return</span> <span style="color: #000088;">$navegador</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="">'Desconocido'</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Luego se puede agregar un condicional que realice una acción según cada resultado. Basado en: <a href="http://www.webintenta.com/detectar-el-navegador-con-php.html">http://www.webintenta.com/detectar-el-navegador-con-php.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/03/detectar-navegador-usando-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Drupal Módulo Smileys - Como crear un nuevo pack</title>
		<link>http://blog.terysoftware.com/2009/01/drupal-modulo-smileys-como-crear-un-nuevo-pack/</link>
		<comments>http://blog.terysoftware.com/2009/01/drupal-modulo-smileys-como-crear-un-nuevo-pack/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 02:00:45 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Css]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[Drupal 5]]></category>

		<category><![CDATA[Modulos]]></category>

		<category><![CDATA[Pack]]></category>

		<category><![CDATA[Smileys]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Tery]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=58</guid>
		<description><![CDATA[Cuando se crean foros resulta bastante útil el proporcionarle al usuario smileys para que pueda personalizar sus comentarios. Drupal cuenta con un módulo para este fin llamado Smileys. El modulo es bastante bueno, sin embargo en su versión para Drupal 5.x nos topamos con bastantes tropiezos.
1. Generalmente los packs que se encuentran para esta versión [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando se crean foros resulta bastante útil el proporcionarle al usuario smileys para que pueda personalizar sus comentarios. Drupal cuenta con un módulo para este fin llamado <a href="http://drupal.org/project/smileys">Smileys</a>. El modulo es bastante bueno, sin embargo en su versión para Drupal 5.x nos topamos con bastantes tropiezos.</p>
<p>1. Generalmente los packs que se encuentran para esta versión son demasiado viejos, y aquellos con gráficos más estilizados se encuentran para la versión 6.x.<br />
2. El módulo se hace bastante inconsistente al trabajar con J-Query Update ya que no permite insertar Emoticons directamente desde el fieldset.<br />
3. Los smileys al ser insertados lo hacen sin una clase lo que hace bastante complicado su manejo en las hojas de estilo.</p>
<p><strong>Cómo crear un pack personalizado para Smileys en Drupal 5</strong></p>
<p>Como lo mencionamos, los packs que vienen para esta versión son bastante anticuados. Hay packs muy estilizados y modernos pero para la versión 6 que emplea archivos XML. Entonces elegimos descargar un tema para Smileys en Drupal 6  y hacer uso de un script que generara un archivo de pack para Drupal 5 a fin de portarlo.</p>
<p>EL tema que portamos es uno llamado <a href="http://www.adiumxtras.com/index.php?a=xtras&#038;xtra_id=5765">Facies</a>
<div id="imagen.post.smileys" style="text-align:center; padding-bottom: 20px;" <img  src="http://www.adiumxtras.com/images/thumbs/facies_2_16962_5765_thumb.png" alt="Smileys Facies Thumbnail" style="display: block; margin: auto;" /> </div>
<p>El script que empleamos para convertir nuestras imágenes en un tema de smileys de Drupal 5, teniendo en cuenta que el nombre del icono queda igual al nombre de archivo es el siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//Script que genera un archivo .pak para Smileys Drupal 5 usando PHP.</span>
&nbsp;
<span style="color: #000088;">$dh</span><span style="color: #339933;">=</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/home/yourdir/&quot;</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">//Directorio con los iconos</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">gettype</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;">$dh</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> boolean<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;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$file&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.gif&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$file2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.gif&quot;</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: #666666; font-style: italic;">//Estensión de archivos.</span>
<span style="color: #990000;">echo</span> <span style="color: #000088;">$file</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;=+:&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$file2</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;=+::&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$file2</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;:&quot;</span>;
<span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dh</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//Modificación del script posteado por yngens en el foro de Drupal.org http://drupal.org/node/169700</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>El Pack de emoticons que creamos se puede hallar en nuestra web de descargas:<br />
<a href="http://www.terysoftware.com/descargas/smileys-facies_theme-d5">http://www.terysoftware.com/descargas/smileys-facies_theme-d5</a></p>
<p></p>
<p><strong>Hacer funcionar Smileys en Drupal 5 con J-Query Update</strong></p>
<p>Dado que revisando los Issues no encontramos aparentemente una solución al tropiezo #2, decidimos desviar al usuario y obligarlo a usar la ventana (Pop Up) con los demás smileys que si funciona con J-Query Update. Lamentablemente todos los smileys se muestran en el fieldset por lo que el usuario no se vería tentado a hacer click en el link &#8220;Show All&#8221; (Que fue previamente habilitado en la página de configuración del módulo). Para tal fín, tuvimos que ingresar al módulo y realizar los siguientes cambios buscando que el fieldset mostrara solo unos pocos emoticons.</p>
<p><span id="more-58"></span><br />
En el archivo de configuración del módulo (modules/smileys/smileys.module) hicimos lo siguiente:</p>
<p>En la línea 25 se encuentra una función que ejecuta una consulta de este modo</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> _smileys_list<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refresh</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$whereclause</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$whereclause</span> <span style="color: #339933;">!=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$whereclause</span> <span style="color: #339933;">=</span> <span style="">' WHERE '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$whereclause</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #990000;">static</span> <span style="color: #000088;">$list</span>;
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$list</span> || <span style="color: #000088;">$refresh</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="">'SELECT * FROM {smileys} '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$whereclause</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> db_fetch_object<span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span>;
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$list</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Lo que hacemos es preparar una nueva lista donde recuperemos no todos los emoticons sino solo algunos de esta manera:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> _smileys_lista<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refresh</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$whereclause</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$whereclause</span> <span style="color: #339933;">!=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$whereclause</span> <span style="color: #339933;">=</span> <span style="">' WHERE '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$whereclause</span>;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #990000;">static</span> <span style="color: #000088;">$list</span>;
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$list</span> || <span style="color: #000088;">$refresh</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Se limita la consulta a  registros.</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="">'SELECT * FROM {smileys} '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$whereclause</span><span style="color: #339933;">.</span><span style="">'LIMIT 5'</span><span style="color: #009900;">&#41;</span>; 
    <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> db_fetch_object<span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span>;
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$list</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Estas listas luego son empleadas por otra funciones como los son _smileys_select_table,  y smileys_table(). Lo que hacemos es duplicar estas funciones pero en esta ocasión pasamos como parámetro la función que creamos (smileys_lista), en ves de smileys_list a las funciones. De esta manera el fieldset solo mostrará cinco emoticons. Las nuevas funciones las nombramos con un 2 al final y les pasamos como parametro la lista original _smileys_list().</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Funciones primitivas</span>
<span style="color: #000000; font-weight: bold;">function</span> _smileys_select_table<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="">''</span>;
&nbsp;
  <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> _smileys_lista<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
 <span style="color: #666666; font-style: italic;">//Con la nueva lista</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$smiley</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000088;">$acronyms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$alt</span> <span style="color: #339933;">=</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="">'  '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$desc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="">'&amp;nbsp; '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="">'&lt;span&gt;&lt;img src=&quot;'</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; title=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#91;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="">'&quot; class=&quot;smiley-class&quot;/&gt;&lt;/span&gt;'</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> smileys_table<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  drupal_add_js<span style="color: #009900;">&#40;</span>drupal_get_path<span style="color: #009900;">&#40;</span><span style="">'module'</span><span style="color: #339933;">,</span> <span style="">'smileys'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'/smileys.js'</span><span style="color: #009900;">&#41;</span>;
  drupal_add_css<span style="color: #009900;">&#40;</span>drupal_get_path<span style="color: #009900;">&#40;</span><span style="">'module'</span><span style="color: #339933;">,</span> <span style="">'smileys'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'/smileys.css'</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="">''</span>;
  <span style="color: #000088;">$header</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#40;</span><span style="">'Smiley'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> t<span style="color: #009900;">&#40;</span><span style="">'Acronyms'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> _smileys_lista<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
 <span style="color: #666666; font-style: italic;">//Con la nueva lista</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$smiley</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$acronyms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#91;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="">'&quot; title=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; class=&quot;smiley-class&quot; /&gt;'</span><span style="color: #339933;">,</span>
      check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'smileys'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'fieldset'</span><span style="color: #339933;">,</span>
    <span style="">'#title'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="">'Smileys'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="">'#collapsible'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'smileys'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="">'smileys_box'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'markup'</span><span style="color: #339933;">,</span>
    <span style="">'#value'</span> <span style="color: #339933;">=&gt;</span> theme<span style="color: #009900;">&#40;</span><span style="">'table'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$header</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> drupal_render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span>;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Funciones duplicadas</span>
<span style="color: #000000; font-weight: bold;">function</span> _smileys_select_table2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="">''</span>;
  <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> _smileys_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
 <span style="color: #666666; font-style: italic;">//Con la lista primitiva.</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$smiley</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$acronyms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$alt</span> <span style="color: #339933;">=</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="">'  '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$desc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="">'&amp;nbsp; '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="">'&lt;span&gt;&lt;img src=&quot;'</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; title=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#91;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="">'&quot; class=&quot;smiley-class&quot;/&gt;&lt;/span&gt;'</span>;
  <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> smileys_table2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  drupal_add_js<span style="color: #009900;">&#40;</span>drupal_get_path<span style="color: #009900;">&#40;</span><span style="">'module'</span><span style="color: #339933;">,</span> <span style="">'smileys'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'/smileys.js'</span><span style="color: #009900;">&#41;</span>;
  drupal_add_css<span style="color: #009900;">&#40;</span>drupal_get_path<span style="color: #009900;">&#40;</span><span style="">'module'</span><span style="color: #339933;">,</span> <span style="">'smileys'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'/smileys.css'</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="">''</span>;
  <span style="color: #000088;">$header</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#40;</span><span style="">'Smiley'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> t<span style="color: #009900;">&#40;</span><span style="">'Acronyms'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> _smileys_list<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
 <span style="color: #666666; font-style: italic;">//Con la lista primitiva</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$smiley</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$acronyms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$acronyms</span><span style="color: #009900;">&#91;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="">'&quot; title=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; class=&quot;smiley-class&quot; /&gt;'</span><span style="color: #339933;">,</span>
      check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'smileys'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'fieldset'</span><span style="color: #339933;">,</span>
    <span style="">'#title'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="">'Smileys'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="">'#collapsible'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="">'smileys'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="">'smileys_box'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'markup'</span><span style="color: #339933;">,</span>
    <span style="">'#value'</span> <span style="color: #339933;">=&gt;</span> theme<span style="color: #009900;">&#40;</span><span style="">'table'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$header</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> drupal_render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Por ultimo, como modificamos las funciones de las tablas, el Pop-Up nos mostraría solo cinco emoticons. Por lo que tenemos que cambiar a fin de que recupere la tabla completa y no la recortada. La función que controla los elementos del Pop-Up es smileys_list(), poor lo que le cambiamos la tabla _smileys_select_table por la nueva es decir la #2.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> smileys_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #990000;">print</span> <span style="">'&lt;div class=&quot;smileysWindowtext&quot;&gt;'</span><span style="color: #339933;">.</span> t<span style="color: #009900;">&#40;</span><span style="">'Click to insert acronym. [&lt;span class=&quot;smiley-class&quot; id=&quot;closeSmileys&quot;&gt;Close&lt;/span&gt;]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&lt;/div&gt;&lt;div class=&quot;smileysWindow&quot;&gt;'</span><span style="color: #339933;">.</span> _smileys_select_table2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&lt;/div&gt;'</span>;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Con esto obtendremos un fieldset con solo cinco emoticons, y guiaremos al usuario a emplear el enlace para ver los demás.</p>
<p><strong>Añadir una clase de CSS a los smileys en Drupal 5</strong></p>
<p>Para añadir la clase a los emoticons hay que editar una linea en el módulo. (modules/smileys/smileys.module) función smileys_filter_process().</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> smileys_filter_process<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="">' '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$text</span> <span style="color: #339933;">.</span><span style="">' '</span>;
&nbsp;
  <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> _smileys_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$smiley</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000088;">$acronyms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">acronyms</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000088;">$alt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'<span style="">\\</span>'</span><span style="color: #339933;">,</span> <span style="">'<span style="">\\\\</span>'</span><span style="color: #339933;">,</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$acronyms</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">standalone</span><span style="color: #009900;">&#41;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//Añadimos en la siguiente cadena lo siguiente: class=\&quot;img_smiley\&quot; poniendo back_slash para escapar las comillas.</span>
        <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">eregi_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;([ ,<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\?</span>!:<span style="color: #000099; font-weight: bold;">\(</span><span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\&lt;</span><span style="color: #000099; font-weight: bold;">\&gt;</span>])&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">preg_quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;([ ,<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\?</span>!:<span style="color: #000099; font-weight: bold;">\(</span><span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\&lt;</span><span style="color: #000099; font-weight: bold;">\&gt;</span>])&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> class=<span style="color: #000099; font-weight: bold;">\&quot;</span>img_smiley<span style="color: #000099; font-weight: bold;">\&quot;</span> title=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$alt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> alt=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$alt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;<span style="color: #000099; font-weight: bold;">\\</span>2&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span>;
&nbsp;
      <span style="color: #b1b100;">else</span>
&nbsp;
        <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">eregi_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span> check_url<span style="color: #009900;">&#40;</span>base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$smiley</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; class=&quot;img_smiley&quot; title=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$alt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$alt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="">'&quot; /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
&nbsp;
&nbsp;
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span>;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Con esto habremos creado una clase img_smiley para los emoticons que se imprimen en el sitio.</p>
<p>Siguiendo estos procedimientos dimos solución a los tres problemas planteados al inicio del post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/01/drupal-modulo-smileys-como-crear-un-nuevo-pack/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Construyendo el portal de Tery Software - Menus animados con kwicks</title>
		<link>http://blog.terysoftware.com/2009/01/construyendo-el-portal-de-tery-software-menus-animados-con-kwicks/</link>
		<comments>http://blog.terysoftware.com/2009/01/construyendo-el-portal-de-tery-software-menus-animados-con-kwicks/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 02:02:20 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[J-Query]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Kwicks]]></category>

		<category><![CDATA[Menús]]></category>

		<category><![CDATA[Tery]]></category>

		<category><![CDATA[Tery Software (Portal)]]></category>

		<category><![CDATA[Tery Software Portal Contrucción Drupal Porque Drupal]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=43</guid>
		<description><![CDATA[Continuando con los artículos de la creación de nuestro portal corporativo, continuamos con la creación de los menús. Generalmente los menús son generados por Drupal de manera automática; sin embargo, estos menus son sencillos links en HTML y buscábamos algo animado. Decidimos emplear un plugin desarrollado en J-Query que proporciona menús de acordeón llamado kwicks.
Específicamente [...]]]></description>
			<content:encoded><![CDATA[<p>Continuando con los artículos de la creación de nuestro portal corporativo, continuamos con la creación de los menús. Generalmente los menús son generados por Drupal de manera automática; sin embargo, estos menus son sencillos links en HTML y buscábamos algo animado. Decidimos emplear un plugin desarrollado en<a href="http://es.wikipedia.org/wiki/JQuery"> J-Query</a> que proporciona menús de acordeón llamado <a href="http://www.jeremymartin.name/projects.php?project=kwicks">kwicks</a>.</p>
<p>Específicamente el ejemplo #1 se ajustaba a una idea que nos surgió de que los personajes de nuestro logo empujaran los menus. Por ser desarrollado sobre J-Query existía una alta posibilidad de que pudiera integrarse con Drupal y de hecho así lo fué, pero ¿ Como hacer que se integrara completamente con la potente gestión de contenido que ofrece Drupal ?.</p>
<p>Dado que Drupal esta desarrollado sobre PHP y es un CMS bastante personalizable, decidimos crear un pequeño script que embedido en el template generara el algoritmo necesario en HTML y JavaScript para cada menu existente.</p>
<p>La manera como se obtuvieron los menús existentes fue capturando la variable $primary_links que es una arreglo y empleando las variables contenidas en dicho arreglo para cada menú. El array $primary_links consta de los siguientes registros por cada menu:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$primary_links</span> <span style="color: #339933;">=&amp;</span>gt; <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;some_menu&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&amp;</span>gt;  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;attributes&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&amp;</span>gt;  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&amp;</span>gt;  string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">33</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Titulo al posar el cursor&quot;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;href&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&amp;</span>gt;  string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;node/6&quot;</span>
		<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&amp;</span>gt;  string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Principal&quot;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>El número de elementos que contendrá el array $primary_links depende directamente del número de menús que hallan sido creados. Para que un menú se muestre animado con kwicks debe cada opción estar codificada así:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;ul class=&quot;kwicks&quot;&gt;
	&lt;li id=&quot;kwick1&quot;&gt;Menu 1&lt;/li&gt;
	&lt;li id=&quot;kwick2&quot;&gt;Menu 2&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>De modo que lo que hacemos es emplear la sentencia de control <a href="http://www.php.net/foreach">foreach</a> para que por cada elemento del arreglo nos genere un menú siguiendo el patrón anterior. Para organizar y estilizar de una mejor manera, decidimos dentro de cada &lt;li&gt; declarar un &lt;h2&gt;(Por ser un subtitulo creemos que es semánticamente correcto) y un &lt;label&gt;. Tambíen cabe mencionar que en el script se emplea una variable de control $n a fin de que los identificadores no se repitan y no incumpla el XHTML. Por último era necesario recuperar el alias de url en ves de la url original, ya que de emplear la original nuestro usuarios estarían siendo dirigidos a páginas del tipo &#8220;node/#&#8221;. A continuación el pequeño script debidamente comentado. Este script fue insertado en un &lt;div$gt; dentro del template principal (page.tpl.php). <a href="http://blog.terysoftware.com/2008/11/construtendo-el-portal-de-tery-software-maqueteado/">ver acerca de PHPTemplate y maqueteado en Drupal.</a></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;kwickmenu&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;kwicks&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;main_links&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>a title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;'.$option[&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../../../../'.$nombre[&quot;</span><span style="color: #339933;">&gt;</span> <span style="">'.$option[&quot;title&quot;].'</span>
					<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;&lt;/</span>h2<span style="color: #339933;">&gt;</span>
<span style="">';}
		/*De lo contrario imprimir sin el alias (path original)*/
		else {
		echo '</span>
	<span style="color: #339933;">&lt;</span>li id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;kwick'.$n.'&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;main_links&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>a title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;'.$option[&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../../../../'.$option[&quot;</span><span style="color: #339933;">&gt;</span> <span style="">'.$option[&quot;title&quot;].'</span>
					<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;&lt;/</span>h2<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span>
<span style="">';}
		$n++;		/* Incrementamos el identificador para la siguiente iteración*/
		}
		?&amp;gt;&lt;/ul&gt;
&lt;/div&gt;</span></pre></div></div>

<p>comentado. Este script fue insertado  dentro del template principal (page.tpl.php). ver acerca de PHPTemplate y maqueteado en Drupal.</p>
<p>De esta manera se integraron los menús con Drupal. Es importante hacer referencia a las hojas de estilo y scripts que vienen contenido en el paquete de kwicks para que funcione correctamente. El resultado se puede apreciar en nuestra web <a href="http://www.terysoftware.com">TerySoftware</a>, un menú animado haciendo uso de un efecto de acordeón.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2009/01/construyendo-el-portal-de-tery-software-menus-animados-con-kwicks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Como actualizar Drupal</title>
		<link>http://blog.terysoftware.com/2008/12/como-actualizar-drupal/</link>
		<comments>http://blog.terysoftware.com/2008/12/como-actualizar-drupal/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 06:12:08 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[actualización]]></category>

		<category><![CDATA[actualizar]]></category>

		<category><![CDATA[CMS]]></category>

		<category><![CDATA[core]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Tery]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=38</guid>
		<description><![CDATA[Generalmente Drupal libera de manera periódica actualizaciones, tanto de cada uno de sus módulos como del core. Generalmente actualizar un módulo es bastante simple, sin embargo, la actualización del core casi siempre puede generar traumatismos si no se realiza de una manera adecuada. Cuando se realiza la actualización de core de nuestras soluciones Drupal se [...]]]></description>
			<content:encoded><![CDATA[<p>Generalmente Drupal libera de manera periódica actualizaciones, tanto de cada uno de sus módulos como del core. Generalmente actualizar un módulo es bastante simple, sin embargo, la actualización del core casi siempre puede generar traumatismos si no se realiza de una manera adecuada. Cuando se realiza la actualización de core de nuestras soluciones Drupal se sigue el siguiente procedimiento:</p>
<p>1. Se descarga y descomprime la versión a la cual se va a a hacer el update.<br />
2. Se copia dentro de la versión los archivos que por configuración del sitio no deben sufrir cambios. (Nosotros realizamos copias de la carpeta sites, y files).<br />
3. Se ingresa al sitio como administrador y se deshabilitan todos aquellos módulos que no vengan incluidos en el core de Drupal.<br />
4. Se sube la actualización al servidor sobreescribiendo aquellos archivos que se encuentren duplicados.<br />
5. Se lleva a cabo la ejecución del script update.php (http://sitio.com/update.php)<br />
6. Una vez terminada la actualización, se habilitan de nuevo los módulos extras.</p>
<p>Siguiendo este proceso se puede evitar de manera sencilla traumatismos en las actualizaciones. Es sumamente importante que los scripts de update e install no estén al acceso del publico. Esto porque un usuario anónimo podría llevar a cabo un downgrade de algún modulo o tratar de instalar de nuevo Drupal. Por esta razón es recomendable retirar estos scripts del raíz.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2008/12/como-actualizar-drupal/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Construyendo el portal de Tery Software - Hoja de estilos</title>
		<link>http://blog.terysoftware.com/2008/12/construyendo-el-portal-de-tery-software-hoja-de-estilos/</link>
		<comments>http://blog.terysoftware.com/2008/12/construyendo-el-portal-de-tery-software-hoja-de-estilos/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 04:48:01 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Css]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[Hojas de estilo]]></category>

		<category><![CDATA[Maqueteado]]></category>

		<category><![CDATA[Tery Software (Portal)]]></category>

		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=27</guid>
		<description><![CDATA[Continuando con el artículo anterior, una vez realizado el maqueteado respetando el estándar XHTML, se procede a ajustar la hoja de estilos. Básicamente las hojas de estilo en cascada o CSS son las que permiten que un documento puramente semántico escrito en HTML adquiera normas y reglas de estilo a fin de ser más agradables [...]]]></description>
			<content:encoded><![CDATA[<p>Continuando con el artículo anterior, una vez realizado el maqueteado respetando el estándar XHTML, se procede a ajustar la hoja de estilos. Básicamente las hojas de estilo en cascada o <a href="http://es.wikipedia.org/wiki/CSS" target="_blank">CSS</a> son las que permiten que un documento puramente semántico escrito en HTML adquiera normas y reglas de estilo a fin de ser más agradables al usuario final.</p>
<p>Cuando se realiza el maqueteado en XHTML  se tiene en cuenta que cada div creado debe tener un identificador. Son precisamente los identificadores, clases y otros atributos similares los que permiten relacionar la estructura con el estilo. Cuando el navegador interpreta el documento, lee en las hojas de estilo las normas declaradas y las aplica a los elementos correspondientes. Para explicar de una manera más clara como se usan las CSS podemos ver un ejemplo.</p>
<p>Si crearamos un div con identificador &#8220;nuevodiv&#8221;&#8230;</p>
<p><code>&lt;div id="nuevodiv"&gt;&lt;/div&gt;</code></p>
<p>Podremos aplicar normas de estilo en las css relacionando el estilo con el identificador que escogimos en el XHTML.</p>
<p><code>#nuevodiv<br />
{<br />
display: block;<br />
float:     left;<br />
background: #fefefe;<br />
}</code></p>
<p>El navegador recorrerá el código y al encontrar el identificador en el div,  aplicará el estilo indicado en las CSS.</p>
<p>Para hacer de las hojas de estilo un elemento más modular, las hojas de estilo cuentan con una jerarquía definida que permite aplicar estilos diferentes aún a elementos HTML muy específicos sin acudir siempre a un identificador. Por ejemplo las clases, permiten añadir normas de estilo a etiquetas definidas en el HTML pero que a nivel de la vista adquieren una connotación diferente.</p>
<p>Por ejemplo podríamos  tener dos títulos h2, uno estándar y otro de clase h2rojo que es de color rojo.</p>
<p><code>&lt;h2&gt;Un título estandar&lt;/h2&gt;<br />
&lt;h2 class="h2rojo"&gt; Un título rojo &lt;/h2&gt;</code></p>
<p>En la hoja de estilos declararíamos:</p>
<p><code>//Las clases se declaran anteponiendo un punto, los identificador con el caracter #<br />
h2 .h2rojo{<br />
color: red;<br />
}</code></p>
<p>Existen varias aplicaciones que permiten realizar el maqueteado de una manera más rápida y eficiente. Se pueden usar herramientas libres como <a href="http://quanta.kdewebdev.org/">Quanta</a> (Del entorno KDE) o incluso plugins del navegador como lo es <a href="http://es.wikipedia.org/wiki/Firebug">Firebug</a>. Este tipo de aplicaciones permiten una visión del resultado a medida que se va añadiendo estilo a las diferentes secciones del HTML.</p>
<p>Lo que permite ganar habilidad en el uso de CSS y aprovechar al máximo lo que ofrecen, es el conocer muy bien la sintaxis y sus propiedades. Para esto hay hojas que contienen resúmenes cortos que son de gran ayuda cuando se esta haciendo el maqueteado. En nuestra sección de descargas se encuentra una de estas <a href="http://www.terysoftware.com/descargas/hoja-de-cheats-css-v2">hojas de cheats de CSS</a>. Viene bien tener un sitio donde se pueden encontrar las propiedades mas utilizadas y demostraciones de uso como <a href="http://www.w3schools.com/css/css_reference.asp">W3Schools</a>.</p>
<p>Una vez realizados estos pasos, se validan tanto el XHTML como las CSS para corroborar que se ha codificado conforme el estándar.</p>
<p><a href="http://validator.w3.org/" target="_blank">Validador de XHTML</a></p>
<p><a href="http://jigsaw.w3.org/css-validator/">Validador de CSS</a></p>
<p>Una vez se tienen los documentos validados, se prosigue con la creación del tema para Drupal.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2008/12/construyendo-el-portal-de-tery-software-hoja-de-estilos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Construyendo el portal de Tery Software - Maqueteado</title>
		<link>http://blog.terysoftware.com/2008/11/construtendo-el-portal-de-tery-software-maqueteado/</link>
		<comments>http://blog.terysoftware.com/2008/11/construtendo-el-portal-de-tery-software-maqueteado/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 00:17:15 +0000</pubDate>
		<dc:creator>Juan David Saab Vanegas</dc:creator>
		
		<category><![CDATA[Desarrollo Web]]></category>

		<category><![CDATA[Drupal]]></category>

		<category><![CDATA[Gráficos]]></category>

		<category><![CDATA[Maqueteado]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[Personalizados]]></category>

		<category><![CDATA[PHPTemplate]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Temas]]></category>

		<category><![CDATA[Tery]]></category>

		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.terysoftware.com/?p=12</guid>
		<description><![CDATA[Primero que todo se realiza el maqueteado de lo que será el sitio web, es decir una especie de croquis donde se pueda apreciar la distribución de información y la diagramación. Al maquetear tenemos una visión futurista, imaginamos la información, la ubicación, colores, animaciones, etc&#8230;
El mayor énfasis que se hizo en el maqueteado fue en [...]]]></description>
			<content:encoded><![CDATA[<p>Primero que todo se realiza el maqueteado de lo que será el sitio web, es decir una especie de croquis donde se pueda apreciar la distribución de información y la diagramación. Al maquetear tenemos una visión futurista, imaginamos la información, la ubicación, colores, animaciones, etc&#8230;</p>
<p>El mayor énfasis que se hizo en el maqueteado fue en un portal orientado al usuario final, de navegación simple y cómoda, sofisticado, estético, con la información a la mano, cumpliendo los estándares de codificado y garantizando una página atractiva a los motores de búsqueda (Clave en el posicionamiento).</p>
<p>El primer paso es crear la estructura en <a href="http://es.wikipedia.org/wiki/XHTML" target="_blank">XHTML</a>, la ídea principal es hacer uso correcto del lenguaje para garantizar una web con buena semántica y sin etiquetas de estilo impropias (Ej: font, center, bgcolor). Lo que garantiza esto, es que la web sea entendida por la mayoría de navegadores, y además tener una web donde la semántica y estructura están claramente separadas del estilo visual.</p>
<p><span id="more-12"></span></p>
<p>Drupal es un CMS construido bajo la arquitectura (Modelo - Vista - Controlador) MVC. A grandes rasgos este tipo de arquitectura busca distribuir la aplicación en tres partes diferentes que se comunican entre sí, garantizando aplicaciones de fácil mantenimiento y escalables. La razón por la que se toca el tema es porque Drupal utiliza motores de plantillas para comunicar la lógica y la parte de interfaz de usuario. Básicamente el motor de plantillas permite combinar el XHTML con las variables y resultados provenientes del controlador (Componente Lógico), lo que nos garantiza seguir disfrutando de la potencia de Drupal (Manejo de contenido) aún cuando cambiemos totalmente el HTML.</p>
<p>Algo a tener claro es que Drupal no es una herramienta para hacer sitios estéticos y de elevado concepto gráfico. No hay que perder de vista que lo que el navegador interpreta siempre es HTML , de modo que la potencia de Drupal no radica en el diseño por el contrario, en garantizar una unión excelente entre el HTML (Vista) y una robusta parte lógica de manejo de contenido, usuarios, etc&#8230; Por supuesto esto no quiere decir que no existan sitios Drupal de excelente estética, de hecho la mayoría lo son. Esta parte ya depende de un buen diseñador.</p>
<p>Bueno después de la introducción manos a la obra, primero se redacta todo el HTML teniendo en cuenta ciertas prácticas:</p>
<p>1. Crear un documento cuya estructura sean Divs, en lo posible no utilizar tablas <a href="http://es.wikipedia.org/wiki/Tableless" target="_blank">&#8220;tableless&#8221;</a>.</p>
<p>2. A cada Div asignarle un Id único, con el que después nos podamos referir a el en la hoja de estilos.</p>
<p>3. Hacer un uso correcto de la semántica del XHTML, usar etiquetas &lt;h1&gt; cuando sean títulos de primer nivel, &lt;strong&gt; para información importante, etc&#8230;</p>
<p>4. Toda etiqueta que se abre debe ser cerrada, de acuerdo al estándar.</p>
<p>Una vez realizada la estructura viene la parte importante, ¿ cómo se combina la vista HTML con la parte lógica de Drupal?</p>
<p>Resumiendo, Drupal almacena los resultados de sus operaciones lógicas en variables predefinidas propias de su entorno. Luego esas variables se asignan al motor de plantillas para emplearlas en la impresión de la vista. El motor que se eligió para el tema grafico de nuestro portal fue <a href="http://drupal.org/project/phptemplate" target="_blank">PHPTemplate</a>. Este motor permite utilizar directamente código en php dentro del HTML con solo abrir las etiquetas &lt;?php ?&gt;; sin embargo, para que el documento sea interpretado por el motor su extensión debe ser cambiada a tpl.php.</p>
<p>Lo que sigue es hacer uso de la variables proporcionadas por Drupal para imprimir los contenidos, bloques, menús, títulos que Drupal genera en su lógica. En un ejemplo sencillo, si se quiere imprimir el título de la pagina y luego el contenido dentro de un div al que identificamos como contenido tendríamos algo de este estilo:</p>
<p><code>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;?php print $head_title ?&gt;&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div id="contenido&gt;<br />
&lt;?php print $contenido ?&gt;<br />
&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt; </code></p>
<p>Donde las variables empleadas ($title, $content) son variables que Drupal tiene por defecto en su API y que se imprimen formateadas es decir con HTML incluido (En su mayoría).</p>
<p>Para referencia en la sección de descargas de nuestra web (<a href="http://www.terysoftware.com/descargas">Tery - Descargas</a>) se encuentra un resumen (En Inglés) de las variables propias que proporciona Drupal para uso con PHPTemplate.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.terysoftware.com/2008/11/construtendo-el-portal-de-tery-software-maqueteado/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
