<?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>Vladzur&#039;s Blog &#187; PHP</title>
	<atom:link href="http://vladzur.sangrederosas.cl/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://vladzur.sangrederosas.cl</link>
	<description>Sobre PHP, Ubuntu, CakePHP y otras cosas</description>
	<lastBuildDate>Mon, 26 Jul 2010 19:06:54 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>jQuery y CakePHP, ahora bien afiatados</title>
		<link>http://vladzur.sangrederosas.cl/2010/07/13/jquery-y-cakephp-ahora-bien-afiatados/</link>
		<comments>http://vladzur.sangrederosas.cl/2010/07/13/jquery-y-cakephp-ahora-bien-afiatados/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 04:15:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://vladzur.sangrederosas.cl/?p=485</guid>
		<description><![CDATA[En la nueva versión de CakePHP 1.3, es posible dejar de usar prototype y cambiarse a jQuery gracias a que cake permite seleccionar que motor de javascript vanos a usar, gracias al JsHelper var $helpers = array('Js' => array('Jquery')); Por defecto los scripts están en una caché, por lo que deben ser escrito al final [...]]]></description>
			<content:encoded><![CDATA[<p>En la nueva versión de CakePHP 1.3, es posible dejar de usar prototype y cambiarse a jQuery gracias a que cake permite seleccionar que motor de javascript vanos a usar, gracias al JsHelper<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="'php'"><div class="devcodeoverflow"><ol><li>var $helpers = array('Js' => array('Jquery'));</li></ol></div></pre><!--END_DEVFMTCODE--><br />
Por defecto los scripts están en una caché, por lo que deben ser escrito al final de la página:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="'php'"><div class="devcodeoverflow"><ol><li>echo $js->writeBuffer();</li></ol></div></pre><!--END_DEVFMTCODE--><br />
Gracias a esto, ya no debemos depender solamente de prototype y scriptaculous, ahora podemos usar nuestro fiel jQuery nativamente con CakePHP.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F07%2F13%2Fjquery-y-cakephp-ahora-bien-afiatados%2F&amp;linkname=jQuery%20y%20CakePHP%2C%20ahora%20bien%20afiatados" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2010/07/13/jquery-y-cakephp-ahora-bien-afiatados/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TyniMVC un mini framework PHP que comienza a nacer.</title>
		<link>http://vladzur.sangrederosas.cl/2010/01/15/tynimvc-un-mini-framework-php-que-comienza-a-nacer/</link>
		<comments>http://vladzur.sangrederosas.cl/2010/01/15/tynimvc-un-mini-framework-php-que-comienza-a-nacer/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 17:39:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[TyniMVC]]></category>

		<guid isPermaLink="false">http://vladzur.sangrederosas.cl/?p=430</guid>
		<description><![CDATA[Ejercitando un poco, me ha nacido la inquietud de crear un pequeño framework PHP de arquitectura MVC, es una pequeña aproximación a un framework pero debido a su extrema simplicidad, me parece adecuado para aprender un poco sobre esta arquitectura de software. El MVC (Modelo Vista Controlador) es un estilo de arquitectura de software que [...]]]></description>
			<content:encoded><![CDATA[<p>Ejercitando un poco, me ha nacido la inquietud de crear un pequeño framework PHP de arquitectura MVC, es una pequeña aproximación a un framework pero debido a su extrema simplicidad, me parece adecuado para aprender un poco sobre esta arquitectura de software.</p>
<p>El MVC (Modelo Vista Controlador) es un estilo de arquitectura de software que se basa en separar la parte lógica (controlador) de la parte visual (vista) y de los datos (modelo). Se utiliza muy a menudo en sistemas web donde la vista es la página, el controlador es el código y el modelo la base de datos (en términos muy superficiales).</p>
<p>La intención de este pequeño proyecto es crear las bases para un framework que nos permita construir nuestro software en base a ésta arquitectura.</p>
<p>Por ahora estoy trabajando en el renderizado de las vistas, me gustaría poder incluir código php dentro de la vista, pero lo que hago hasta ahora es leer un archivo &#8220;algo.tpl&#8221;, buscar las etiquetas de inserción &#8220;{elemento}&#8221; y reemplazarlo por el contenido del array $dato(&#8216;elemento&#8217;=>&#8217;valor&#8217;).</p>
<p>Bueno, les dejo mi código para que lo despedacen y me hagan sus comentarios.</p>
<p><a href='http://vladzur.sangrederosas.cl/wp-content/2010/01/TyniMVC.zip'>TyniMVC</a><br />
<a href="http://code.google.com/p/tynimvc/">Sitio del proyecto</a></p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2010%2F01%2F15%2Ftynimvc-un-mini-framework-php-que-comienza-a-nacer%2F&amp;linkname=TyniMVC%20un%20mini%20framework%20PHP%20que%20comienza%20a%20nacer." title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2010/01/15/tynimvc-un-mini-framework-php-que-comienza-a-nacer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Componente para subir y redimensionar imágenes en CakePHP</title>
		<link>http://vladzur.sangrederosas.cl/2009/10/25/componente-para-subir-y-redimensionar-imagenes-en-cakephp/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/10/25/componente-para-subir-y-redimensionar-imagenes-en-cakephp/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 03:40:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://vladzur.sangrederosas.cl/?p=366</guid>
		<description><![CDATA[Un interesante componente para CakePHP que permite cargar y redimensionar imágenes y generar miniaturas de la imágen incluso de acercamientos y cuadradas. Este componente fué escrito en base a varios otros recursos por el autor. Ver componente aquí. Me acabo de enterar de la existencia de este componente gracias a un mensaje en la lista [...]]]></description>
			<content:encoded><![CDATA[<p>Un interesante componente para CakePHP que permite cargar y redimensionar imágenes y generar miniaturas de la imágen incluso de acercamientos y cuadradas.</p>
<p>Este componente fué escrito en base a varios otros recursos por el autor.</p>
<p><a href="http://sabbour.wordpress.com/2008/05/13/image-upload-and-resize-component-for-cakephp-12/" target="_blank">Ver componente aquí</a>.</p>
<p>Me acabo de enterar de la existencia de este componente gracias a un mensaje en la lista de CakePHP en español, aún no lo he probado, pero he leído buenos comentarios.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F25%2Fcomponente-para-subir-y-redimensionar-imagenes-en-cakephp%2F&amp;linkname=Componente%20para%20subir%20y%20redimensionar%20im%C3%A1genes%20en%20CakePHP" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/10/25/componente-para-subir-y-redimensionar-imagenes-en-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalar EclipsePHP WebDAV + FTP en Ubuntu</title>
		<link>http://vladzur.sangrederosas.cl/2009/10/04/instalar-eclipsephp-webdav-ftp-en-ubuntu/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/10/04/instalar-eclipsephp-webdav-ftp-en-ubuntu/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 01:30:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://vladzur.sangrederosas.cl/?p=266</guid>
		<description><![CDATA[Para instalar EclipsePHP con su plugin de sincronización FTP WebDAV, debemos primero descargarlo. Una vez descargado, lo descomprimimos en nuestro home. Para obtener la última versión de WebDAV + FTP debemos descargarla desde aquí, el desarrollo de este plugin está abandonado, por lo que debemos conformarnos con la versión 3.2.2. Una vez descargado el plugin, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-268" title="eclipse" src="http://vladzur.sangrederosas.cl/wp-content/2009/10/eclipse.png" alt="eclipse" width="171" height="91" />Para instalar EclipsePHP con su plugin de sincronización FTP WebDAV, debemos primero <a href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-php-galileo-SR1-linux-gtk.tar.gz" target="_blank">descargarlo</a>.</p>
<p>Una vez descargado, lo descomprimimos en nuestro home.</p>
<p>Para obtener la última versión de WebDAV + FTP debemos descargarla desde <a href="http://archive.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-FTP-WebDAV-3.2.2.zip" target="_blank">aquí</a>, el desarrollo de este plugin está abandonado, por lo que debemos conformarnos con la versión 3.2.2.</p>
<p>Una vez descargado el plugin, debemos instalarlo en Eclipse, para ello debemos descomprimir el archivo en el directorio de eclipse.</p>
<p>Ahora podemos comenzar a desarrollar nuestros proyectos PHP manteniendo sincronizados nuestros archivos locales y en el servidor remoto de manera fácil y rápida.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F10%2F04%2Finstalar-eclipsephp-webdav-ftp-en-ubuntu%2F&amp;linkname=Instalar%20EclipsePHP%20WebDAV%20%2B%20FTP%20en%20Ubuntu" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/10/04/instalar-eclipsephp-webdav-ftp-en-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poner tags PHP correctos</title>
		<link>http://vladzur.sangrederosas.cl/2009/09/14/poner-tags-php-correctos/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/09/14/poner-tags-php-correctos/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 13:49:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://vladzur.wordpress.com/2009/09/14/poner-tags-php-correctos/</guid>
		<description><![CDATA[Esta es una traducción de un artículo antiguo escrito originalmente en francés. Si tuviste el mal hábito o tienes algunos scripts php antiguos que usan tas etiquetas PHP cortas (ej. &#60;? ?&#62; en vez de &#60;?php ?&#62;), lo qual está deshabilitado por defecto en la versión actual de PHP, el siguiente script (shorttags.sh) es para [...]]]></description>
			<content:encoded><![CDATA[<p>Esta es una traducción de un artículo antiguo escrito originalmente en francés.<br />
Si tuviste el mal hábito o tienes algunos scripts php antiguos que usan tas etiquetas PHP cortas (ej. &lt;? ?&gt; en vez de &lt;?php ?&gt;), lo qual está deshabilitado por defecto en la versión actual de PHP, el siguiente script (shorttags.sh) es para tí:<br />
<code><br />
#!/bin/sh<br />
find &quot;$@&quot; -name &quot;*.php&quot; -exec perl -i -wpe 's/&lt;?=/&lt;?php echo /g' {} ;<br />
-exec perl -i -wpe 's/&lt;?(?!php)/&lt;?php /g' {} ;<br />
</code></p>
<p>Luego de escribir el script, debes hacerlo ejecutable:<br />
<code><br />
chmod +x shorttags.sh<br />
</code></p>
<p>Luego, puedes usarlo así (no olvides respaldar tus preciosos scripts, nunca se sabe&#8230;):<br />
<code><br />
./shorttags.sh /ruta/tus/archivos/php/<br />
</code></p>
<p>Puedes poner más de una ruta desde esta línea de comandos.</p>
<p>(original <a href="http://planet.ubuntu.com/">http://planet.ubuntu.com/</a>)</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F14%2Fponer-tags-php-correctos%2F&amp;linkname=Poner%20tags%20PHP%20correctos" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/09/14/poner-tags-php-correctos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Clase para conectar MySQL</title>
		<link>http://vladzur.sangrederosas.cl/2009/09/09/php-clase-para-conectar-mysql/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/09/09/php-clase-para-conectar-mysql/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 17:04:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[clase]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://vladzur.wordpress.com/2009/09/09/php-clase-para-conectar-mysql/</guid>
		<description><![CDATA[Siempre que necesitamos conectar una base de datos MySQL con PHP, debemos escribir unas cuantas instrucciones una y otra vez, para evitar esto, lo mejor es usar una clase que maneje nuestra conexión. El siguiente, es el código de una clase que nos puede ayudar: &#60;?php/** database.php** Copyright 2008 Vladimir Zurita &#60;&#60;a href=&#34;mailto:vladzur@gmail.com&#34;&#62;vladzur@gmail.com&#60;/a&#62;&#62;** This program [...]]]></description>
			<content:encoded><![CDATA[<p>Siempre que necesitamos conectar una base de datos MySQL con PHP, debemos escribir unas cuantas instrucciones una y otra vez, para evitar esto, lo mejor es usar una clase que maneje nuestra conexión.<br />
El siguiente, es el código de una clase que nos puede ayudar:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li><span style="color: #666666; font-style: italic;">/*</span></li><li><span style="color: #666666; font-style: italic;">* database.php</span></li><li><span style="color: #666666; font-style: italic;">*</span></li><li><span style="color: #666666; font-style: italic;">* Copyright 2008 Vladimir Zurita &lt;&lt;a href=&quot;mailto:vladzur@gmail.com&quot;&gt;vladzur@gmail.com&lt;/a&gt;&gt;</span></li><li><span style="color: #666666; font-style: italic;">*</span></li><li><span style="color: #666666; font-style: italic;">* This program is free software; you can redistribute it and/or modify</span></li><li><span style="color: #666666; font-style: italic;">* it under the terms of the GNU General Public License as published by</span></li><li><span style="color: #666666; font-style: italic;">* the Free Software Foundation; either version 2 of the License, or</span></li><li><span style="color: #666666; font-style: italic;">* (at your option) any later version.</span></li><li><span style="color: #666666; font-style: italic;">*</span></li><li><span style="color: #666666; font-style: italic;">* This program is distributed in the hope that it will be useful,</span></li><li><span style="color: #666666; font-style: italic;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></li><li><span style="color: #666666; font-style: italic;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></li><li><span style="color: #666666; font-style: italic;">* GNU General Public License for more details.</span></li><li><span style="color: #666666; font-style: italic;">*</span></li><li><span style="color: #666666; font-style: italic;">* You should have received a copy of the GNU General Public License</span></li><li><span style="color: #666666; font-style: italic;">* along with this program; if not, write to the Free Software</span></li><li><span style="color: #666666; font-style: italic;">* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,</span></li><li><span style="color: #666666; font-style: italic;">* MA 02110-1301, USA.</span></li><li><span style="color: #666666; font-style: italic;">*/</span></li><li>&nbsp;</li><li><span style="color: #666666; font-style: italic;">/********************************************************</span></li><li><span style="color: #666666; font-style: italic;">* DataBase</span></li><li><span style="color: #666666; font-style: italic;">* Author: Vladimir Zurita</span></li><li><span style="color: #666666; font-style: italic;">*</span></li><li><span style="color: #666666; font-style: italic;">* This class makes easier to insert data into a table and connect</span></li><li><span style="color: #666666; font-style: italic;">* a database on MySQL</span></li><li><span style="color: #666666; font-style: italic;">* *******************************************************/</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">class</span> DataBase <span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$db</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'host'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span></li><li><span style="color: #0000ff;">'user'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'your_user'</span><span style="color: #339933;">,</span></li><li><span style="color: #0000ff;">'pass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'your_password'</span><span style="color: #339933;">,</span></li><li><span style="color: #0000ff;">'dbase'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'your_database'</span></li><li><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$link</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbase'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ssql</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ssql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><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></li><li><span style="color: #000088;">$output</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$row</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> save<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$campos</span><span style="color: #339933;">=</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$desc</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">describe_tabla</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$campos</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$campo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$campo</span><span style="color: #339933;">==</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Field'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">=</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;varchar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;int&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;blob&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$field</span><span style="color: #339933;">.=</span><span style="color: #000088;">$campo</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$field</span><span style="color: #339933;">=</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$value</span><span style="color: #339933;">=</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;INSERT INTO &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; (&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$field</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;) VALUES (&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//echo $sql;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span><span style="color: #000088;">$condicion</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$campos</span><span style="color: #339933;">=</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$desc</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">describe_tabla</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$campos</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$campo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$campo</span><span style="color: #339933;">==</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Field'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">=</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;varchar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #000088;">$campo</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #000088;">$campo</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;int&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #000088;">$campo</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tipo</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;blob&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">.=</span><span style="color: #000088;">$campo</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$campo</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', &quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000088;">$value</span><span style="color: #339933;">=</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UPDATE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; SET &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; WHERE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$condicion</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//echo $sql;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> delete<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">,</span> <span style="color: #000088;">$condicion</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;DELETE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; WHERE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$condicion</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">function</span> describe_tabla<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tabla</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;DESCRIBE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$tabla</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$res</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$output</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="color: #0000ff;">'Field'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Field'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Type'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000000; font-weight: bold;">?&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--><br />
El modo de uso es simple, veamos un ejemplo:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>sin título<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content-type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html;charset=utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;generator&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Geany 0.14&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;example.php&quot;</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">fieldset</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data[name]&quot;</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data[last_name]&quot;</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data[email]&quot;</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data[address]&quot;</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span>&gt;</span>Save<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">fieldset</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Y recogemos el formulario con:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;database.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$DB</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DataBase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><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;">'data'</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></li><li><span style="color: #000088;">$data</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'data'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$DB</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000000; font-weight: bold;">?&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fphp-clase-para-conectar-mysql%2F&amp;linkname=PHP%3A%20Clase%20para%20conectar%20MySQL" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/09/09/php-clase-para-conectar-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Plugin de seguridad para Cake</title>
		<link>http://vladzur.sangrederosas.cl/2009/09/09/plugin-de-seguridad-para-cake/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/09/09/plugin-de-seguridad-para-cake/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 16:57:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://vladzur.wordpress.com/2009/09/09/plugin-de-seguridad-para-cake/</guid>
		<description><![CDATA[Para descargar el plugin sigue éste enlace http://www.4shared.com/file/131400156/e521c155/seguridad.html El plugin se instala en la carpeta /app/plugins/ El uso de este plugin es simple, primero debemos crear dos tablas en nuestra base de datos. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';&#160;CREATE&#160;&#160;TABLE IF NOT EXISTS `perfil` &#40;`id` INT NOT NULL AUTO_INCREMENT ,`nombre` VARCHAR&#40;45&#41; NULL ,PRIMARY KEY &#40;`id`&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Para descargar el plugin sigue éste enlace <a href="http://www.4shared.com/file/131400156/e521c155/seguridad.html">http://www.4shared.com/file/131400156/e521c155/seguridad.html</a><br />
El plugin se instala en la carpeta /app/plugins/<br />
El uso de este plugin es simple, primero debemos crear dos tablas en nuestra base de datos.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="SQL"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #993333; font-weight: bold;">SET</span> @OLD_UNIQUE_CHECKS<span style="color: #66cc66;">=</span>@@UNIQUE_CHECKS<span style="color: #66cc66;">,</span> UNIQUE_CHECKS<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>;</li><li><span style="color: #993333; font-weight: bold;">SET</span> @OLD_FOREIGN_KEY_CHECKS<span style="color: #66cc66;">=</span>@@FOREIGN_KEY_CHECKS<span style="color: #66cc66;">,</span> FOREIGN_KEY_CHECKS<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>;</li><li><span style="color: #993333; font-weight: bold;">SET</span> @OLD_SQL_MODE<span style="color: #66cc66;">=</span>@@SQL_MODE<span style="color: #66cc66;">,</span> SQL_MODE<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'TRADITIONAL'</span>;</li><li>&nbsp;</li><li><span style="color: #993333; font-weight: bold;">CREATE</span>&nbsp;&nbsp;<span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`perfil`</span> <span style="color: #66cc66;">&#40;</span></li><li><span style="color: #ff0000;">`id`</span> INT <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #ff0000;">`nombre`</span> VARCHAR<span style="color: #66cc66;">&#40;</span>45<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span></li><li>ENGINE <span style="color: #66cc66;">=</span> InnoDB;</li><li>&nbsp;</li><li><span style="color: #993333; font-weight: bold;">CREATE</span>&nbsp;&nbsp;<span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`permiso`</span> <span style="color: #66cc66;">&#40;</span></li><li><span style="color: #ff0000;">`id`</span> INT <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #ff0000;">`autorizado`</span> TINYINT<span style="color: #66cc66;">&#40;</span>1<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #ff0000;">`perfil_id`</span> INT <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #ff0000;">`controlador`</span> VARCHAR<span style="color: #66cc66;">&#40;</span>45<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #ff0000;">`accion`</span> VARCHAR<span style="color: #66cc66;">&#40;</span>45<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span></li><li><span style="color: #993333; font-weight: bold;">INDEX</span> <span style="color: #ff0000;">`fk_permiso_perfil1`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`perfil_id`</span> <span style="color: #993333; font-weight: bold;">ASC</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span></li><li>CONSTRAINT <span style="color: #ff0000;">`fk_permiso_perfil1`</span></li><li><span style="color: #993333; font-weight: bold;">FOREIGN</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`perfil_id`</span> <span style="color: #66cc66;">&#41;</span></li><li><span style="color: #993333; font-weight: bold;">REFERENCES</span> <span style="color: #ff0000;">`perfil`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">&#41;</span></li><li><span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DELETE</span> NO ACTION</li><li><span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">UPDATE</span> NO ACTION<span style="color: #66cc66;">&#41;</span></li><li>ENGINE <span style="color: #66cc66;">=</span> InnoDB;</li><li>&nbsp;</li><li><span style="color: #993333; font-weight: bold;">SET</span> SQL_MODE<span style="color: #66cc66;">=</span>@OLD_SQL_MODE;</li><li><span style="color: #993333; font-weight: bold;">SET</span> FOREIGN_KEY_CHECKS<span style="color: #66cc66;">=</span>@OLD_FOREIGN_KEY_CHECKS;</li><li><span style="color: #993333; font-weight: bold;">SET</span> UNIQUE_CHECKS<span style="color: #66cc66;">=</span>@OLD_UNIQUE_CHECKS;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Luego, configurar en nuestro plugin el archivo app/plugins/seguridad/controllers/components/seguridad.php<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$excepciones</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pages'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Login'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'logout'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'admin_index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'admin_logout'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Aquí debemos poner las acciones y controladores que no deben ser supervisados por el plugin con el formato array(&#8216;Controlador&#8217;=&gt;array(&#8216;accion1&#8242;, &#8216;accion2&#8242;,&#8230;,&#8217;accionN&#8217;)).<br />
Lo siguiente es añadir el plugin a nuestra aplicación, para esto, ponemos en /app/app_controller.php<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$components</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Seguridad.Seguridad'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>y la función:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> beforeFilter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #000088;">$controlador</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>params<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'controller'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$accion</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>params<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Seguridad<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isException<span style="color: #009900;">&#40;</span><span style="color: #000088;">$controlador</span><span style="color: #339933;">,</span> <span style="color: #000088;">$accion</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Seguridad<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>checkAuth<span style="color: #009900;">&#40;</span><span style="color: #000088;">$controlador</span><span style="color: #339933;">,</span> <span style="color: #000088;">$accion</span><span style="color: #339933;">,</span> <span style="color: #000088;">$perfil</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</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></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>redirect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/pages/denegado'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Ahora vamos a <a href="http://nuestro-sitio.com/seguridad/seguridad_perfil">http://nuestro-sitio.com/seguridad/seguridad_perfil</a> y creamos los perfiles necesarios, al editarlos podemos darle la autorización de acceso a la acción correspondiente a cada controlador.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F09%2Fplugin-de-seguridad-para-cake%2F&amp;linkname=Plugin%20de%20seguridad%20para%20Cake" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/09/09/plugin-de-seguridad-para-cake/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Utilizar modelos y tablas en singular</title>
		<link>http://vladzur.sangrederosas.cl/2009/09/07/utilizar-modelos-y-tablas-en-singular/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/09/07/utilizar-modelos-y-tablas-en-singular/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 21:10:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[inflections]]></category>
		<category><![CDATA[modelo]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://vladzur.wordpress.com/?p=23</guid>
		<description><![CDATA[Para poder usar los modelos y tablas en singular, debemos agregar una excepción en la configuración de Cake. inflections.php $uninflectedPlural = array('.*'); Ahora podemos usar nombres de tablas sin importar si están en singular o plural, usando en el modelo el mismo nombre de la tabla que hemos creado.]]></description>
			<content:encoded><![CDATA[<p>Para poder usar los modelos y tablas en singular, debemos agregar una excepción en la configuración de Cake.</p>
<p>inflections.php<br />
<pre>$uninflectedPlural = array('.*');</pre><br />
Ahora podemos usar nombres de tablas sin importar si están en singular o plural, usando en el modelo el mismo nombre de la tabla que hemos creado.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Futilizar-modelos-y-tablas-en-singular%2F&amp;linkname=Utilizar%20modelos%20y%20tablas%20en%20singular" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/09/07/utilizar-modelos-y-tablas-en-singular/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como mantener un filtro con paginación</title>
		<link>http://vladzur.sangrederosas.cl/2009/09/07/como-mantener-un-filtro-con-paginacion/</link>
		<comments>http://vladzur.sangrederosas.cl/2009/09/07/como-mantener-un-filtro-con-paginacion/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 20:48:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Filtro]]></category>
		<category><![CDATA[Paginator]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://vladzur.wordpress.com/?p=21</guid>
		<description><![CDATA[Una de los usos más comunes de las paginaciónes es limitar la visualización de el resultado de una búsqueda. Cake no da una manera fácil de hacer esta cotidiana tarea, pero se puede solucionar este problema usando &#8220;Session&#8221;. function admin_index() {     $criteria=null; $cond=array(); if(!empty($this-&#62;data)){ $apellido_paterno=$this-&#62;data['Buscar']['apellido_paterno']; $nombre=$this-&#62;data['Buscar']['nombre']; $rut=trim($this-&#62;data['Buscar']['rut']);             if($apellido_paterno!='')$cond[]="Usuario.apellido_paterno LIKE '%$apellido_paterno%' "; [...]]]></description>
			<content:encoded><![CDATA[<p>Una de los usos más comunes de las paginaciónes es limitar la visualización de el resultado de una búsqueda.</p>
<p>Cake no da una manera fácil de hacer esta cotidiana tarea, pero se puede solucionar este problema usando &#8220;Session&#8221;.<br />
<pre>function admin_index() {    
 $criteria=null;
 $cond=array();
 if(!empty($this-&gt;data)){
 $apellido_paterno=$this-&gt;data['Buscar']['apellido_paterno'];
 $nombre=$this-&gt;data['Buscar']['nombre'];
 $rut=trim($this-&gt;data['Buscar']['rut']);            
 if($apellido_paterno!='')$cond[]="Usuario.apellido_paterno LIKE '%$apellido_paterno%' ";
 if($nombre!='')$cond[]="Usuario.nombre LIKE '%$nombre%' ";
 if($rut!='')$cond[]="Usuario.rut =$rut ";
 if(count($cond)&gt;1){
 $criteria=implode(" AND ",$cond);
 }else{
 $criteria=$cond[0];
 $this-&gt;Session-&gt;write('Filtro.usuario', $criteria);
 }            
 if(empty($cond))$criteria=null;                
 }
 $filtro = $this-&gt;Session-&gt;read('Filtro.usuario');
 $this-&gt;set('usuario', $this-&gt;paginate('Usuario',$filtro));        
}</pre><br />
Éste trozo de código, implementa una búsqueda de usuario por nombre, apellido paterno o RUT (DNI), guardando el filtro en una variable de sesion, para usarlo atravez de las distintas páginas.</p>
<p>Para resetear el filtro, solo debemos borrar la variable de sesión<br />
<pre>$this-&gt;Session-&gt;write('Filtro.usuario', null);</pre><br />
Así podemos mostrar todos los registros sin el filtro de búsqueda.</p>
<p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><p><a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Digg" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Facebook" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Delicious" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fvladzur.sangrederosas.cl%2F2009%2F09%2F07%2Fcomo-mantener-un-filtro-con-paginacion%2F&amp;linkname=Como%20mantener%20un%20filtro%20con%20paginaci%C3%B3n" title="Twitter" rel="nofollow" target="_blank"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://vladzur.sangrederosas.cl/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vladzur.sangrederosas.cl/2009/09/07/como-mantener-un-filtro-con-paginacion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
