<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Johan de Bruin</title>
	<atom:link href="http://www.johandebruin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johandebruin.com</link>
	<description>Programación en php, tutorial de api wordpress y posicionamiento en buscadores seo.</description>
	<lastBuildDate>Wed, 30 Jun 2010 11:33:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Configurar el loop de wordpress</title>
		<link>http://www.johandebruin.com/configurar-el-loop-de-wordpress/</link>
		<comments>http://www.johandebruin.com/configurar-el-loop-de-wordpress/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 11:26:26 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[API wordpress]]></category>
		<category><![CDATA[Custom loop]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=609</guid>
		<description><![CDATA[Hoy os traigo otro artículo para incorporarlo en la api de wordpress, el loop de wordpress es invocado cada vez que solicitamos articulos o páginas, en el index por ejemplo sale por defecto la solicitud de los últimos artículos publicados, en el archivo los articulos de cierto mes o cierta categoria, etc&#8230; La api de [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy os traigo otro artículo para incorporarlo en la <a href="http://www.johandebruin.com/tutorial-api-wordpress/">api de wordpress</a>, el <strong>loop de wordpress </strong>es invocado cada vez que solicitamos articulos o páginas, en el index por ejemplo sale por defecto la solicitud de los últimos artículos publicados, en el archivo los articulos de cierto mes o cierta categoria, etc&#8230;</p>
<p>La <strong>api de wordpress nos permite una configuración bastante intensa </strong>de la forma de solicitar y mostrar contenido en los loops de wordpress, lo primero de todo es establecer los posts que queramos mostrar en el loop, se puede hacer usando la función <a href="http://codex.wordpress.org/Function_Reference/query_posts">query_posts()</a>;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat=4,5'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Todos los que esten en la categoria 4 y 5</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tag=mitag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Los que tengan cierto tag...</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'meta_key=nombrekey&amp;amp;meta_value=valorkey'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Tenga un campo personalizado con dichos valores</span>
&nbsp;
 <span style="color: #000088;">$categoria</span><span style="color: #339933;">=</span><span style="color: #000088;">$cat</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// asignamos la actual categoria</span>
 <span style="color: #000088;">$query</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'cat='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$categoria</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;amp;orderby=date&amp;amp;order=ASC'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//ordenacion ascendente por fecha</span>
 query_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><span id="more-609"></span><br />
Como veis, tenemos mucho con que jugar a la hora de configurar el contenido del loop de wordpress, una vez hecho podemos crear el loop, tiene la siguiente estructura:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//...</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">//...</span>
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
wp_reset_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Importante reiniciar loop para que wordpress funcione como habitualmente</span></pre></div></div>

<p>Una vez dentro del loop podemos llamar a muchos valores de los posts, como por ejemplo el contenido, los tags, fecha, titulos, extracto, campos personalizados, la categoria&#8230; Aquí un ejemplo de como seria el código completo</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">query_posts('cat='.get_cat_ID('miCategoria')); //Establecemos el query con los posts de &quot;miCategoria&quot;
if (have_posts()) : while (have_posts()) : the_post();
     &lt;p&gt;&lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;&lt;/p&gt;
     &lt;p&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> ?<span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$postMeta</span> <span style="color: #339933;">=</span> get_post_custom_values<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'metaKey'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$postMeta</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;p&gt;<span style="color: #006699; font-weight: bold;">$key</span>  =&gt; <span style="color: #006699; font-weight: bold;">$value</span> ('metaKey')&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
endwhile; else:
    echo &quot;No se encontraron articulos relacionados, puede que le interese alguna de las siguientes categorias&quot;
&lt;ul&gt;
   <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;
endif;
wp_reset_query();</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/configurar-el-loop-de-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear Plantillas de themes para post en WordPress</title>
		<link>http://www.johandebruin.com/crear-plantillas-de-themes-para-post-en-wordpress/</link>
		<comments>http://www.johandebruin.com/crear-plantillas-de-themes-para-post-en-wordpress/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 20:42:28 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Custom Values]]></category>
		<category><![CDATA[Plantilla]]></category>
		<category><![CDATA[Post meta]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Wordpress API]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=599</guid>
		<description><![CDATA[Podemos crear una plantilla para publicar post especificos en wordpress de la misfa forma que ocurre con las páginas gracias a la combinación del uso de la API de wordpress y del plugin Custom Post Template. Lo que queremos conseguir es mostrar posts de distintas maneras en función a que plantilla seleccionamos en el menu [...]]]></description>
			<content:encoded><![CDATA[<p>Podemos crear una plantilla para publicar post especificos en wordpress de la misfa forma que ocurre con las páginas gracias a la combinación del uso de la API de wordpress y del plugin <a title="Plantilla Post WordPress" href="http://wordpress.org/extend/plugins/custom-post-template/">Custom Post Template</a>. Lo que queremos conseguir es mostrar posts de distintas maneras en función a que plantilla seleccionamos en el menu de post:</p>
<p><a href="http://www.johandebruin.com/wp-content/uploads/2010/06/post-template.jpg"><img src="http://www.johandebruin.com/wp-content/uploads/2010/06/post-template.jpg" alt="" title="post template" width="296" height="365" class="aligncenter size-full wp-image-600" /></a></p>
<p>Gracias a eso, y a un formato de recognición de templates de post, con que añadamos el siguiente comentario en el .php del theme de wordpress podremos definir un formato especifico para ese tipo de post (como añadir metas especificos, imagenes, colores, opciones etc&#8230; especifico), explotando más las posibilidades de wordpress.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name Posts: nombrePlantilla
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><span id="more-599"></span><br />
Aqui un ejemplo de como podriamos adaptar esta plantilla usando comandos de la API de wordpress (lo tipico, llamada al header, titulos, contenido, campos personalizados.. ).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name Posts: nombrePlantilla
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
   &lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
   <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p class=&quot;serif&quot;&gt;Leer el resto del post;&lt;/p&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
   $postMeta = get_post_custom_values('metaKey');
   foreach ( $postMeta as $key =&gt; $value ) {
      echo &quot;$key  =&gt; $value ('metaKey')&lt;br /&gt;&quot;; 
   }
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/crear-plantillas-de-themes-para-post-en-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mostrar elementos ocultados con javascript</title>
		<link>http://www.johandebruin.com/mostrar-elementos-ocultados-con-javascript/</link>
		<comments>http://www.johandebruin.com/mostrar-elementos-ocultados-con-javascript/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 17:55:26 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mostrar contenido]]></category>
		<category><![CDATA[ocultar contenido]]></category>
		<category><![CDATA[snnipet]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=593</guid>
		<description><![CDATA[Aquí una rápida pieza de código que permitira ocultar contenido para luego mostrarlo si así lo quiere el usuario. Empleamos javascript junto al reconocimiento DOM de elementos html para definir el contenido de un div. &#60;head&#62; &#60;script type=&#34;text/javascript&#34;&#62; function mostrar() { document.getElementById(&#34;contenedor&#34;).innerHTML = 'hola mundo'; } &#60;/script&#62; &#60;/head&#62; &#60;body&#62; &#60;a href=&#34;javascript://&#34; onclick=&#34;mostrar()&#34;&#62;Mostrar contenido del contenedor&#60;/a&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Aquí una rápida pieza de código que permitira ocultar contenido para luego mostrarlo si así lo quiere el usuario. Empleamos javascript junto al reconocimiento DOM de elementos html para definir el contenido de un div.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function mostrar()
{
	document.getElementById(&quot;contenedor&quot;).innerHTML = 'hola mundo';
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href=&quot;javascript://&quot; onclick=&quot;mostrar()&quot;&gt;Mostrar contenido del contenedor&lt;/a&gt;
&lt;div id=&quot;contenedor&gt;
&lt;!-- Este contenedo ahora mismo esta vacio --&gt;
&lt;/div&gt;</pre></div></div>

<p><span id="more-593"></span><br />
Y así de facil, únicamente tenemos que hacer referencia con el atributo de onclick a la función que insertara contenido al elemento que queramos mostrar, también sirve para cambiar de imagen, únicamente deberiamos usar el atributo de javascript document.getElementById(&#8220;contenedor&#8221;).src al hacer click a la imagen&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/mostrar-elementos-ocultados-con-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Analizar si el contenido es relevante</title>
		<link>http://www.johandebruin.com/analizar-si-el-contenido-es-relevante/</link>
		<comments>http://www.johandebruin.com/analizar-si-el-contenido-es-relevante/#comments</comments>
		<pubDate>Sat, 29 May 2010 14:59:32 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Contenido relevante]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[Optimización SEO]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=561</guid>
		<description><![CDATA[Hoy en día ya no basta con describir los metatag de forma eficiciente, sino que además debes identificar si tanto google, como la estructura de tu página se identifican con relevante en los terminos que tratas de posicionar. Para ello existen varias estrategias de análisis, la primera de ellas es hacer un scaneo de las [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy en día ya no basta con describir los metatag de forma eficiciente, sino que además debes identificar si tanto google, como la estructura de tu página se identifican con relevante en los terminos que tratas de posicionar.</p>
<p>Para ello existen varias estrategias de análisis, la primera de ellas es hacer un scaneo de las palabras más repetitivas de tu página web. Para ello, podemos emplear el escaneo de <a title="plugin firefox SEO" href="http://www.seobook.com/seo-firefox-now-seo-x-ray">SEO xray de seobook</a>.</p>
<p><img src="http://www.johandebruin.com/wp-content/uploads/2010/05/seo-xray.jpg" alt="" title="seo xray" width="564" height="464" class="aligncenter size-full wp-image-562" /><br />
<span id="more-561"></span><br />
Lo primero que podemos apreciar es un analisis de los links de entrantes y salientes, una apreciación de la definición de los metatags y la configuración para analizar la densidad de las palabras. Podemos analizar que enlaces nos hacen referencia y decidir <strong>cambiar nuestra política de link building </strong>en caso de que no sean páginas de la tematica relevante.</p>
<p><img src="http://www.johandebruin.com/wp-content/uploads/2010/05/lista-densidad-keywords.jpg" alt="" title="lista densidad keywords" width="800" height="364" class="aligncenter size-full wp-image-563" /></p>
<p>Una vez analizado la densidad del texto, debemos tratar de que la densidad de las <strong>keywords relevantes a posicionar esten entre un 2% y 3%.</strong></p>
<p>Además, podemos emplear el comando de google <strong>related:dominio.tld </strong>para saber con que páginas relaciona un buscador la tuya.</p>
<p>Como podeis apreciar mi blog personal tiene bastante trabajo por hacer&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/analizar-si-el-contenido-es-relevante/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solo Dios y Google</title>
		<link>http://www.johandebruin.com/google-y-dios/</link>
		<comments>http://www.johandebruin.com/google-y-dios/#comments</comments>
		<pubDate>Wed, 12 May 2010 19:56:53 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Filosofia informatica]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lectura]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=553</guid>
		<description><![CDATA[&#8220;Una persona suele leer con una compresión de entre 45-65%, alguien entrenado llega hasta el 85%, un filosofo es capaz de alcanzar entre 90-95% de compresión lectora. El autor del texto sería capaz de entender hasta el 99% de este, solo Dios y Google es capaz de entender el 100%&#8220;]]></description>
			<content:encoded><![CDATA[<p><center><em>&#8220;Una persona suele leer con una compresión de entre <font size="+2">45-65%</font>, alguien entrenado llega hasta el <font size="+2">85%</font>, un filosofo es capaz de alcanzar entre <font size="+2">90-95%</font> de compresión lectora. El autor del texto sería capaz de entender hasta el <font size="+2">99%</font> de este, solo Dios y Google es capaz de entender el <font size="+2">100%</font>&#8220;</em></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/google-y-dios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programacion orientada a objetos y diagramas UML en PHP</title>
		<link>http://www.johandebruin.com/programacion-orientada-a-objetos-y-diagramas-uml-en-php/</link>
		<comments>http://www.johandebruin.com/programacion-orientada-a-objetos-y-diagramas-uml-en-php/#comments</comments>
		<pubDate>Tue, 11 May 2010 06:10:48 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[clases]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[poo]]></category>
		<category><![CDATA[programacion orientada a objetos]]></category>
		<category><![CDATA[uml]]></category>
		<category><![CDATA[uml php]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=525</guid>
		<description><![CDATA[Una recopilación de como construir clases en PHP junto a un diagrama de la relación UML. Útil para ir obteniendo nociones sobre el modelado del código. Herencia Indica que una clase hereda todos los atributos y métodos de otra, hay que tener en cuenta que en el diagrama UML el triangulo toca al padre: class [...]]]></description>
			<content:encoded><![CDATA[<p>Una recopilación de como construir clases en PHP junto a un diagrama de la relación UML. Útil para ir obteniendo nociones sobre el modelado del código.</p>
<h3>Herencia</h3>
<p>Indica que una clase hereda todos los atributos y métodos de otra, hay que tener en cuenta que en el diagrama UML el triangulo toca al padre:</p>
<pre lang="php" style="float:left;width:420px">
class Senior {

}
class Junior extends Senior {

}
</pre>
<p><img style="float:right" src="http://www.johandebruin.com/wp-content/uploads/2010/05/herencia.gif" alt="herencia php" title="herencia php" width="102" height="179" class="aligncenter size-full wp-image-527" /><br />
<br style="clear: both" /><br />
<span id="more-525"></span></p>
<h3>Agregación</h3>
<p>Es cuando una clase puede es parte de otra, con lo cual esta primera clase tendrá acceso a los métodos de la segunda. Al haber sido instanciada fuera de la segunda, aunque esta muera la primera seguira viviendo. Se les conoce como clases &#8220;Data Access&#8221;, y se dice que la primera clase controla parte de la segunda. Se relacionan con un diamante que toca la clase controlada</p>
<pre lang="php" style="float:left;width:420px">
class Dao {
    function getSomething() {
    }
}
class Model {
    var $dao;
    function Model (&#038; $dao) {
        $this->dao=&#038; $dao;
    }
    function doSomething () {
        $this->dao->getSomething();
    }
}
$dao=new Dao;
$model=new Model($dao);
$model->doSomething();
</pre>
<p><img style="float:right" src="http://www.johandebruin.com/wp-content/uploads/2010/05/agregacionpoo.gif" alt="herencia php" title="herencia php" width="102" height="179" class="aligncenter size-full wp-image-527" /></p>
<p><br style="clear: both" /></p>
<h3>Composición</h3>
<p>Es cuando una clase instancia a otra, esta segunda instancia moriria con la primera, esto significa que la primera clase controla a toda la segunda, se representa con un solido diamante tocando a la clase controlada.</p>
<pre lang="php" style="float:left;width:420px">
class LinkWidget {
}
class View {
    var $linkWidget;
    var $page;
    function View () {
        $this->linkWidget=new LinkWidget;
    }
    function renderPage () {
        $this->page=$this->linkWidget->display()
    }
}
</pre>
<p><img style="float:right" src="http://www.johandebruin.com/wp-content/uploads/2010/05/composicionpooo.gif" alt="herencia php" title="herencia php" width="102" height="179" class="aligncenter size-full wp-image-527" /></p>
<p><br style="clear: both" /></p>
<h3>Mensajes</h3>
<p>Es cuando una clase comunica a otra que está controlando una instancia suya. En php suele emplearse el <a href="http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php">operador scope</a>. Que sirve para hacer referencias a métodos de clases que no estan instanciadas.</p>
<pre lang="php" style="float:left;width:420px">
class HtmlUtils {
    function unHtmlEntities ($str) {
        $trans_tbl =
get_html_translation_table (HTML_ENTITIES);
        $trans_tbl = array_flip ($trans_tbl);
        return strtr ($str, $trans_tbl);
    }
}
class View {
    function renderPage {
        $text=HtmlUtils::unHtmlEntities($text);
    }
}
</pre>
<p><img style="float:right" src="http://www.johandebruin.com/wp-content/uploads/2010/05/mensajeUnidireccionalpoo.gif" alt="herencia php" title="herencia php" width="102" height="179" class="aligncenter size-full wp-image-527" /></p>
<p><br style="clear: both" /><br />
Existe otra variante de esta relación, donde el mensaje se envia mutuamente entre las dos clases, un ejemplo de código:</p>
<pre lang="php" style="float:left;width:420px">
class Debug {
    function display () {
        echo ($this->errorMsg);
    }
}
class SomeClass {
    var $errorMsg='This is an error message';
    function someFunction () {
        if ( DEBUG == 1 ) {
            Debug::display();
        }
    }
}
define ('DEBUG',1);
$someClass= &#038;new SomeClass;
$someClass->someFunction();
</pre>
<p><img style="float:right" src="http://www.johandebruin.com/wp-content/uploads/2010/05/bidireccionalpoo.gif" alt="bidireccional php" title="herencia php" width="102" height="179" class="aligncenter size-full wp-image-527" /></p>
<p><br style="clear: both" /></p>
<p>Fuente, <a href="http://www.phppatterns.com/docs/design/php_and_uml_class_diagrams">phppatterns</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/programacion-orientada-a-objetos-y-diagramas-uml-en-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mapa de Clicks de unos urinarios publicos</title>
		<link>http://www.johandebruin.com/mapa-de-clicks-de-los-urinarios/</link>
		<comments>http://www.johandebruin.com/mapa-de-clicks-de-los-urinarios/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 07:01:13 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Humor Google]]></category>
		<category><![CDATA[Humor SEO]]></category>
		<category><![CDATA[Mapa Google]]></category>
		<category><![CDATA[Tasa Clicks]]></category>
		<category><![CDATA[Tasa de Click urinarios]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=509</guid>
		<description><![CDATA[Bueno, hoy os traigo un poco de humor SEO, he photoshopeado la típica imagen que muestra el mapa de los clicks donde suelen hacer click los usuarios en el buscador y he transportado la teoría a los urinarios públicos (ni cagando puedo dejar de pensar en el SEO).]]></description>
			<content:encoded><![CDATA[<p>Bueno, hoy os traigo un poco de humor SEO, he photoshopeado la típica imagen que muestra el <a href="http://www.johandebruin.com/wp-content/uploads/2010/04/google-mapa-clicks-copia.png">mapa de los clicks</a> donde suelen hacer click los usuarios en el buscador y he transportado la teoría a los urinarios públicos (ni cagando puedo dejar de pensar en el SEO).</p>
<p><a href="http://www.johandebruin.com/wp-content/uploads/2010/04/tasa-de-clicks-urinarios1.png"><img src="http://www.johandebruin.com/wp-content/uploads/2010/04/tasa-de-clicks-urinarios1.png" alt="tasa de clicks urinarios" title="tasa de clicks urinarios" width="349" height="750" class="aligncenter size-full wp-image-515" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/mapa-de-clicks-de-los-urinarios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Factores de Posicionamiento geolocalizado</title>
		<link>http://www.johandebruin.com/factores-de-posicionamiento-geolocalizado/</link>
		<comments>http://www.johandebruin.com/factores-de-posicionamiento-geolocalizado/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 17:25:35 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Geolocalizacion]]></category>
		<category><![CDATA[Geolocalizado]]></category>
		<category><![CDATA[geoseo]]></category>
		<category><![CDATA[Posicionamiento geolocalizacion]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=499</guid>
		<description><![CDATA[El posicionamiento geolocalizado está ganando cáda vez más importancia debido a la búsqueda universal implementa ya resultados geolocalizados, y debido a la inserción de la vida cotidiana en internet (ya buscamos proximos destinos, servicios, compras&#8230;). La forma de realizar una optimización de la página para adaptarla a los resultados geolocalizados es cuestión de muchos factores. [...]]]></description>
			<content:encoded><![CDATA[<p>El posicionamiento geolocalizado está ganando cáda vez más importancia debido a la búsqueda universal implementa ya resultados geolocalizados, y debido a la inserción de la vida cotidiana en internet (ya buscamos proximos destinos, servicios, compras&#8230;).</p>
<p>La forma de realizar una optimización de la página para adaptarla a los resultados geolocalizados es cuestión de muchos factores. El primero de ellos es la optimización de los metatags, un ejemplo de meta-tags optimizados a la geolocalización es la siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">	&lt;meta name=&quot;geo.placename&quot; content=&quot;Madrid&quot; /&gt;
	&lt;meta name=&quot;geo.position&quot; content=&quot;28.8092295;-2.1007066&quot; /&gt;
	&lt;meta name=&quot;geo.region&quot; content=&quot;es&quot; /&gt;
	&lt;meta name=&quot;ICBM&quot; content=&quot;28.8092295;-2.1007066&quot; /&gt;</pre></div></div>

<h4>Optimización de los metatags</h4>
<p>Otros factores importantes para el posicionamiento geolocalizado son los siguientes:</p>
<h4>Inserción en Local Buisness Center</h4>
<p>Esta opción solo seria para las empresas que quieran geolocalizarse con google, para ello podemos recurrir al <a title="Local Buisness Center" href="http://maps.google.com/local/add/splashPage?hl=es&amp;gl=ES">Local Buisness Center</a> de Google.</p>
<h4>Usar un dominio del país de origen</h4>
<p>Un factor muy relevante, usar un dominio .es o .mx (Dominios de Nivel Superior Geográfico) influye muchisimo cuando se busca en google, a veces es el condicionante entre salir antes que la competencia directa.</p>
<h4>Optimización del contenido</h4>
<p>Un clasico que nunca hay que olvidar, si por ejemplo queremos posicionar una empresa para servicios en madrid, es importante que esta keyword tenga una densidad entre el 1,5% y el 3% del contenido en la página.</p>
<h4>Avisar a los buscadores de la localización de nuestra página</h4>
<p>Paneles de controles como <a title="Webmaster tools" href="https://www.google.com/webmasters/tools/">Google Webmaster Tool</a>, permite geolocalizar el país de destino de una página web, esta opción se encuentra en la pesataña &#8220;configuración&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/factores-de-posicionamiento-geolocalizado/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Porque ahora solo me comunico por las redes sociales</title>
		<link>http://www.johandebruin.com/porque-ahora-solo-me-comunico-por-las-redes-sociales/</link>
		<comments>http://www.johandebruin.com/porque-ahora-solo-me-comunico-por-las-redes-sociales/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 23:04:09 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Redes sociales]]></category>
		<category><![CDATA[SMO]]></category>
		<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=493</guid>
		<description><![CDATA[Pues eso, el motivo por el que ahora únicamente empleo las redes sociales para mandar mensajes o incluso mailearlos&#8230;]]></description>
			<content:encoded><![CDATA[<p>Pues eso, el motivo por el que ahora únicamente empleo las redes sociales para mandar mensajes o incluso mailearlos&#8230;<br />
<a href="http://www.johandebruin.com/wp-content/uploads/2010/03/ahora-solo-redes-sociales.jpg"><img src="http://www.johandebruin.com/wp-content/uploads/2010/03/ahora-solo-redes-sociales.jpg" alt="" title="ahora solo redes sociales" width="823" height="546" class="aligncenter size-full wp-image-494" /></a></p>
<p> <img src='http://www.johandebruin.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/porque-ahora-solo-me-comunico-por-las-redes-sociales/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Añadir opciones a un plugin wordpress</title>
		<link>http://www.johandebruin.com/anadir-opciones-a-un-plugin-wordpress/</link>
		<comments>http://www.johandebruin.com/anadir-opciones-a-un-plugin-wordpress/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 14:18:29 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Añadir opciones wordpress]]></category>
		<category><![CDATA[API wordpress]]></category>
		<category><![CDATA[Opciones wordpress]]></category>
		<category><![CDATA[Plugin wordpress]]></category>
		<category><![CDATA[Programar plugins wordpress]]></category>

		<guid isPermaLink="false">http://www.johandebruin.com/?p=480</guid>
		<description><![CDATA[Consta de una variable para establecer un nombre de id para establecer las opciones en la base de datos, añadir la acción al hook del menu al construir el plugin, establecer como aparecerá en la pestaña las opcinones con add_options_page, y el código que mostrará y gestionará las opciones insertadas. Aquí un ejemplo básico de [...]]]></description>
			<content:encoded><![CDATA[<p>Consta de una variable para establecer un nombre de id para establecer las opciones en la base de datos, añadir la acción al hook del menu al construir el plugin, establecer como aparecerá en la pestaña las opcinones con <strong>add_options_page</strong>, y el código que mostrará y gestionará las opciones insertadas. Aquí un ejemplo básico de como quedaría:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> miPlugin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$db_option</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'miPlugin_Options'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> miPlugin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//Línea para incluir el menú</span>
		add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'miMenu'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'admin_menu'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> miMenu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		add_options_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Opciones del plugin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Algun id'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'opciones'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> opciones<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_options</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submitted'</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>
		  check_admin_referer<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nonce'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  <span style="color: #000088;">$options</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: #339933;">;</span>
		  <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		  <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		  update_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db_option</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// Aquí establecemos algunas variables que usaremos en el form</span>
		<span style="color: #000088;">$action_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
       	&lt;form name=&quot;SnazzyArchives&quot; action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$action_url</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nonce_field<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nonce'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;input type=&quot;checkbox&quot; name=&quot;a&quot;  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$a</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;&lt;label&gt; Show Posts&lt;/label&gt;  &lt;br /&gt;
            &lt;input type=&quot;checkbox&quot; name=&quot;b&quot;  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$b</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;&lt;label&gt; Show Pages&lt;/label&gt;  &lt;br /&gt;
            &lt;div&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Update&quot; /&gt;&lt;/div&gt;
       	&lt;/form&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Solo decir que que las opciones se obtienen con <em>$options = $this->get_options();</em> y se establecen con <em>update_option($this->db_option, $options);</em> Además, <em><?php wp_nonce_field('nonce'); ?></em> sirve como parametro de seguridad para cercionarnos que se está empleando el formulario correcto. Esto luego se comprueba con <em>check_admin_referer(&#8216;nonce&#8217;);</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johandebruin.com/anadir-opciones-a-un-plugin-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
