<?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>Rogério Lino</title>
	<atom:link href="http://rogeriolino.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rogeriolino.com</link>
	<description>Desenvolvimento Web, tecnologia, jogos e etcetera</description>
	<lastBuildDate>Wed, 16 May 2012 19:51:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>HTML5: Websocket</title>
		<link>http://rogeriolino.com/2012/05/16/html5-websocket/</link>
		<comments>http://rogeriolino.com/2012/05/16/html5-websocket/#comments</comments>
		<pubDate>Wed, 16 May 2012 19:48:48 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[hybi]]></category>
		<category><![CDATA[rfc6455]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[websocket]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=563</guid>
		<description><![CDATA[<p> <a href="http://www.rfc-editor.org/rfc/rfc6455.txt" title="RFC 6455">The Websocket Protocol</a><br /> The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the origin-based security model commonly used by web browsers. The protocol consists [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><blockquote><p>
<center><a href="http://www.rfc-editor.org/rfc/rfc6455.txt" title="RFC 6455">The Websocket Protocol</a></center><br />
 The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host    that has opted-in to communications from that code.  The security model used for this is the origin-based security model commonly used by web browsers.  The protocol consists of an opening handshake followed by basic message framing, layered over TCP.  The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g., using XMLHttpRequest or &lt;iframe&gt;s and long polling).
</p></blockquote>
<p>Aproveitando um post sobre <a href="http://rogeriolino.com/2010/04/22/php-socket-class/" title="PHP Socket class">PHP Sockets</a> que tinha escrito unindo o estudo sobre Websocket, eu criei um <a href="https://github.com/rogeriolino/phpsocket" title="Github: PHP Socket project">projeto no Github</a> para facilitar o uso de sockets com PHP fornecendo suporte ao Websocket também.</p>
<p>E para visualizar o <a href="https://github.com/rogeriolino/phpsocket/tree/master/demo/websocket" title="Websocket chat example">exemplo</a> basta fazer checkout do projeto, executar o arquivo server.php: </p>
<pre name="code" class="php">
> $ php server.php
</pre>
<p>E abrir a página chat.html pelo browser. O funcionamento do exemplo vai depender, além obviamente do suporte à Websocket, do tipo da versão da implementação do browser. Por enquanto a suportada pelo projeto é a HyBi (descrita na <a href="http://www.rfc-editor.org/rfc/rfc6455.txt" title="RFC 6455">RFC 6455</a>).</p>
<div class="shr-publisher-563"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F05%2F16%2Fhtml5-websocket%2F' data-shr_title='HTML5%3A+Websocket'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F05%2F16%2Fhtml5-websocket%2F' data-shr_title='HTML5%3A+Websocket'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F05%2F16%2Fhtml5-websocket%2F' data-shr_title='HTML5%3A+Websocket'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/05/16/html5-websocket/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extensões Google Chrome</title>
		<link>http://rogeriolino.com/2012/04/09/extensoes-google-chrome/</link>
		<comments>http://rogeriolino.com/2012/04/09/extensoes-google-chrome/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 20:48:33 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[Programas]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[extensoes]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonview]]></category>
		<category><![CDATA[perfectpixel]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[silver bird]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[web developer]]></category>
		<category><![CDATA[window close protector]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=546</guid>
		<description><![CDATA[<p>Em 2006 publiquei um post listando algumas <a href="http://rogeriolino.com/2006/07/06/extensoes-firefox/" title="Extensões Firefox" target="_blank">extensões que recomendava para o Firefox</a>, o tempo passou e acabei mudando de browser também. E o mais engraçado é que mesmo mudando de browser, as duas extensões que sempre fiz questão de instalar no Firefox, hoje também são pré-requisitos no Chrome. São elas:</p> [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Em 2006 publiquei um post listando algumas <a href="http://rogeriolino.com/2006/07/06/extensoes-firefox/" title="Extensões Firefox" target="_blank">extensões que recomendava para o Firefox</a>, o tempo passou e acabei mudando de browser também. E o mais engraçado é que mesmo mudando de browser, as duas extensões que sempre fiz questão de instalar no Firefox, hoje também são pré-requisitos no Chrome. São elas:</p>
<dl>
<dt><a href="https://chrome.google.com/webstore/detail/bmagokdooijbeehmkpknfglimnifench" title="Firebug Lite" target="_blank">Firebug</a></dt>
<dd>Firebug Lite is not a substitute for Firebug, or Chrome Developer Tools. It is a tool to be used in conjunction with these tools. Firebug Lite provides the rich visual representation we are used to see in Firebug when it comes to HTML elements, DOM elements, and Box Model shading. It provides also some cool features like inspecting HTML elemements with your mouse, and live editing CSS properties.</dd>
<dt><a href="https://chrome.google.com/webstore/detail/bfbameneiokkgbdmiekhjnmfkcnldhhm" title="Web Developer" target="_blank">Web Developer</a></dt>
<dd>The Web Developer extension adds a toolbar button to the browser with various web developer tools. This is the official port of the popular Web Developer extension for Firefox written by the same person.</dd>
</dl>
<p>Além dessas que considero obrigatórias, recomendo também as seguintes extensões:</p>
<dl>
<dt><a href="https://chrome.google.com/webstore/detail/chklaanhfefbnpoihckbnefhakgolnmc" title="JSONView" target="_blank">JSONView</a></dt>
<dd>Valida e formata páginas com conteúdo JSON. Excelente extensão.</dd>
<dt><a href="https://chrome.google.com/webstore/detail/dkaagdgjmgdmbnecmcefdhjekcoceebi" title="PerfectPixel" target="_blank">PerfectPixel</a></dt>
<dd>This extension allows developers to put a semi-transparent image overlay over the top of the developed HTML and perform per pixel comparison between them. Analogue of popular Firefox extension PixelPerfect.</dd>
<dt><a href="https://chrome.google.com/webstore/detail/encaiiljifbdbjlphpgpiimidegddhic" title="Silver Bird" target="_blank">Silver Bird</a> <em>(utilizava o Tweetdeck até ser necessária a criação de uma outra conta)</em></dt>
<dd>Silver Bird is an awesome Twitter client extension for Google Chrome with lots of features.</dd>
<dt><a href="https://chrome.google.com/webstore/detail/cpngackimfmofbokmjmljamhdncknpmg" title="Screen Capture" target="_blank">Screen Capture by Google</a></dt>
<dd>It&#8217;s easy to use this extension to capture visible content of a tab, a region of a web page, or the whole page as a PNG image.</dd>
<dt><a href="https://chrome.google.com/webstore/detail/lnpifgapnmpninomacbhdlconlpikdai" title="Window Close Protector" target="_blank">Window Close Protector</a></dt>
<dd>Show a warning dialog when closing a window containing multiple tabs.</dd>
</dl>
<div class="shr-publisher-546"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F04%2F09%2Fextensoes-google-chrome%2F' data-shr_title='Extens%C3%B5es+Google+Chrome'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F04%2F09%2Fextensoes-google-chrome%2F' data-shr_title='Extens%C3%B5es+Google+Chrome'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F04%2F09%2Fextensoes-google-chrome%2F' data-shr_title='Extens%C3%B5es+Google+Chrome'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/04/09/extensoes-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Validate Filters</title>
		<link>http://rogeriolino.com/2012/03/16/php-validate-filters/</link>
		<comments>http://rogeriolino.com/2012/03/16/php-validate-filters/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 17:46:43 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[classe]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filters]]></category>
		<category><![CDATA[filter_var]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[validator]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=529</guid>
		<description><![CDATA[<p>A partir do PHP 5.2 foi introduzida a função <a href="http://php.net/filter_var" title="PHP: filter_var">filter_var</a>. Que serve justamente para filtrar uma variável a partir de um filtro especificado.</p> mixed filter_var ( mixed $variable [, int $filter = FILTER_DEFAULT [, mixed $options ]] ) // Returns the filtered data, or FALSE if the filter fails. <p>Filtros pré-definidos:</p> // [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>A partir do PHP 5.2 foi introduzida a função <a href="http://php.net/filter_var" title="PHP: filter_var">filter_var</a>. Que serve justamente para filtrar uma variável a partir de um filtro especificado.</p>
<blockquote>
<pre>
mixed filter_var ( mixed $variable [, int $filter = FILTER_DEFAULT [, mixed $options ]] )
// Returns the filtered data, or FALSE if the filter fails.
</pre>
</blockquote>
<p>Filtros pré-definidos:</p>
<pre name="code" class="php">
// email filtering
echo filter_var('email@domain.com', FILTER_VALIDATE_EMAIL); // email@domain.com
echo filter_var('domain.com', FILTER_VALIDATE_EMAIL); // false

// url filtering
echo filter_var('http://rogeriolino.com', FILTER_VALIDATE_URL); // http://rogeriolino.com
echo filter_var('rogeriolino.com', FILTER_VALIDATE_URL); // false

// ip filtering
echo filter_var('127.0.0.1', FILTER_VALIDATE_IP); // 127.0.0.1
echo filter_var('127.0.1', FILTER_VALIDATE_IP); // false
</pre>
<p>Como a função pode retornar <strong>FALSE</strong> (caso o filtro falhe) ou o valor filtrado. Podemos utilizar o <strong>Not identical operator</strong> (!==) para verificar se retorno é realmente FALSE, ou seja, o valor testado não passou pelo filtro.</p>
<p>Colocando em prática a função mais orientação à objetos para criar algumas classes validadoras:</p>
<pre name="code" class="php">

/**
 * Interface Validator
 */
interface Validator {

    public function isValid($value);

}

/**
 * Abstract class Simple Validator
 */
abstract class SimpleValidator implements Validator {

    protected abstract function defaultFilter();

    public function isValid($value) {
        return filter_var($value, $this->defaultFilter()) !== false;
    }

}

/**
 * Simple Email validator
 */
class EmailValidator extends SimpleValidator {

    protected function defaultFilter() {
        return FILTER_VALIDATE_EMAIL;
    }

}

/**
 * Simple URL validator
 */
class UrlValidator extends SimpleValidator {

    protected function defaultFilter() {
        return FILTER_VALIDATE_URL;
    }

}

/**
 * Simple IP Validator
 */
class IpValidator extends SimpleValidator {

    protected function defaultFilter() {
        return FILTER_VALIDATE_IP;
    }

}
</pre>
<p>Testando</p>
<pre name="code" class="php">
// email validating
$validator = new EmailValidator();
echo $validator->isValid('rogeriolino@com'); // false
echo $validator->isValid('contact@rogeriolino.com'); // true
echo $validator->isValid('contact+spam@rogeriolino.com'); // true

// URL validating
$validator = new UrlValidator();
echo $validator->isValid('http://rogeriolino.com'); // true
echo $validator->isValid('http://rogeriolino.com/contact'); // true
echo $validator->isValid('rogeriolino.com/contact'); // false
echo $validator->isValid('https://rogeriolino'); // true
echo $validator->isValid('ftp://rogeriolino.com'); // true

// URL validating
$validator = new IpValidator();
echo $validator->isValid('127.0.0.1'); // true
echo $validator->isValid('127.0.0'); // false
echo $validator->isValid('1050:0000:0000:0000:0005:0600:300c:326b'); // true
echo $validator->isValid('1050:0000:0000:0000:0005:0600'); // false
</pre>
<p>Para ver outros filtros:<br />
<a href="http://php.net/manual/filter.filters.validate.php" target="_blank">http://php.net/manual/filter.filters.validate.php</a></p>
<div class="shr-publisher-529"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F16%2Fphp-validate-filters%2F' data-shr_title='PHP%3A+Validate+Filters'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F16%2Fphp-validate-filters%2F' data-shr_title='PHP%3A+Validate+Filters'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F16%2Fphp-validate-filters%2F' data-shr_title='PHP%3A+Validate+Filters'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/03/16/php-validate-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickpost: Cut the Rope</title>
		<link>http://rogeriolino.com/2012/03/02/quickpost-cut-the-rope/</link>
		<comments>http://rogeriolino.com/2012/03/02/quickpost-cut-the-rope/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 14:37:37 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jogos]]></category>
		<category><![CDATA[Quickpost]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[ctr]]></category>
		<category><![CDATA[cuttherope]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[pxloader]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=518</guid>
		<description><![CDATA[<p><a href="http://www.cuttherope.ie/" target="_blank" title="Click to play!"><br /> <br /> </a></p> <p>HTML5 version</p> <p>Play: <a href="http://www.cuttherope.ie" target="_blank">http://www.cuttherope.ie</a><br /> Development info: <a href="http://www.cuttherope.ie/dev" target="_blank">http://www.cuttherope.ie/dev</a></p> <a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://www.cuttherope.ie/" target="_blank" title="Click to play!"><br />
<img src="http://rogeriolino.com/wp-content/uploads/2012/03/cuttherope.png" alt="" title="Click to play!" width="764" height="255" class="aligncenter size-full wp-image-519" /><br />
</a></p>
<p><strong>HTML5 version</strong></p>
<p>Play: <a href="http://www.cuttherope.ie" target="_blank">http://www.cuttherope.ie</a><br />
Development info: <a href="http://www.cuttherope.ie/dev" target="_blank">http://www.cuttherope.ie/dev</a></p>
<div class="shr-publisher-518"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F03%2F02%2Fquickpost-cut-the-rope%2F' data-shr_title='Quickpost%3A+Cut+the+Rope'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/03/02/quickpost-cut-the-rope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Easy SQL date time formatting</title>
		<link>http://rogeriolino.com/2012/02/01/php-easy-sql-date-time-formatting/</link>
		<comments>http://rogeriolino.com/2012/02/01/php-easy-sql-date-time-formatting/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 18:26:03 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array_reverse]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[explode]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[formatação]]></category>
		<category><![CDATA[hora]]></category>
		<category><![CDATA[implode]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[strtotime]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=478</guid>
		<description><![CDATA[<p>SQL to Human:</p> /* * date */ $format = 'm/d/Y'; // en-US // $format = 'd/m/Y'; // pt-BR $date = '2012-02-01'; echo date($format, strtotime($date)); /* * datetime */ $format .= ' H:i:s'; $datetime = '2012-02-01 11:33:59'; echo date($format, strtotime($datetime)); <p>Human to SQL:</p> /* * date */ $sqlFormat = 'Y-m-d'; $date = '02/01/2012'; // en-US echo [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><strong>SQL to Human:</strong></p>
<pre name="code" class="php">
/*
 * date
 */
$format = 'm/d/Y'; // en-US
// $format = 'd/m/Y'; // pt-BR
$date = '2012-02-01';
echo date($format, strtotime($date));

/*
 * datetime
 */
$format .= ' H:i:s';
$datetime = '2012-02-01 11:33:59';
echo date($format, strtotime($datetime));
</pre>
<p><strong>Human to SQL:</strong></p>
<pre name="code" class="php">
/*
 * date
 */
$sqlFormat = 'Y-m-d';
$date = '02/01/2012';

// en-US
echo date($sqlFormat, strtotime($date));
// pt-BR
echo join('-', array_reverse(explode('/', $date)));

/*
 * datetime
 */
$sqlFormat = 'Y-m-d H:i:s';

// en-US
$datetime = '02/01/2012 11:33:59';
echo date($sqlFormat, strtotime($datetime));

// pt-BR
$datetime = '01/02/2012 11:33:59';
$datetime = explode(' ', $datetime);
$date = join('-', array_reverse(explode('/', $datetime[0])));
echo $date . ' ' . $datetime[1];
</pre>
<p><strong>Reference:</strong></p>
<p><a href="http://php.net/strtotime" title="PHP.net">strtotime</a><br />
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in now, or the current time if now is not supplied.</p>
<p><a href="http://php.net/date" title="PHP.net">date</a><br />
Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. In other words, timestamp is optional and defaults to the value of <a href="http://php.net/time" title="PHP.net">time()</a>.</p>
<p><a href="http://php.net/explode" title="PHP.net">explode</a><br />
Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.</p>
<p><a href="http://php.net/array_reverse" title="PHP.net">array_reverse</a><br />
Takes an input array and returns a new array with the order of the elements reversed.</p>
<p><a href="http://php.net/join" title="PHP.net">join / implode</a><br />
Join array elements with a glue string.</p>
<div class="shr-publisher-478"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F02%2F01%2Fphp-easy-sql-date-time-formatting%2F' data-shr_title='PHP%3A+Easy+SQL+date+time+formatting'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F02%2F01%2Fphp-easy-sql-date-time-formatting%2F' data-shr_title='PHP%3A+Easy+SQL+date+time+formatting'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F02%2F01%2Fphp-easy-sql-date-time-formatting%2F' data-shr_title='PHP%3A+Easy+SQL+date+time+formatting'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/02/01/php-easy-sql-date-time-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Vertical Scroller Plugin</title>
		<link>http://rogeriolino.com/2012/01/23/jquery-vertical-scroller-plugin/</link>
		<comments>http://rogeriolino.com/2012/01/23/jquery-vertical-scroller-plugin/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 19:44:50 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[Quickpost]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[scroller]]></category>
		<category><![CDATA[vertical]]></category>
		<category><![CDATA[vscroller]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=461</guid>
		<description><![CDATA[<p><a href="https://github.com/rogeriolino/vscroller/"><br /> <br /> </a></p> <p>Hoje criei um novo projeto no Github, para um plugin para jQuery (1.7+) que desenvolvi (estou e estarei desenvolvendo). Trata-se um scroller vertical que pode ser aplicado a qualquer tag block.</p> $('#news').vScroller({ width: 300, height: 400 }); <p>Conforme surgir demanda, necessidade de mais funcionalidades, callbacks, eu irei incrementando o [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="https://github.com/rogeriolino/vscroller/"><br />
    <img src="http://rogeriolino.com/wp-content/uploads/2012/01/vscroller.png" alt="" title="vScroller" width="600" height="100" class="aligncenter size-full wp-image-462" /><br />
</a></p>
<p>Hoje criei um novo projeto no Github, para um plugin para jQuery (1.7+) que desenvolvi (estou e estarei desenvolvendo). Trata-se um scroller vertical que pode ser aplicado a qualquer tag block.</p>
<pre name="code" class="js">
    $('#news').vScroller({
        width: 300,
        height: 400
    });
</pre>
<p>Conforme surgir demanda, necessidade de mais funcionalidades, callbacks, eu irei incrementando o projeto. Embora simples, está funcional, e serve como estudo.</p>
<p><em>[update 2012-01-24]</em><br />
<strong>Features:</strong></p>
<ul>
<li>MouseWheel</li>
<li>Drag&#038;Drop</li>
<li>Keys (UP, DOWN, PG_UP, PG_DOWN, HOME, END)</li>
</ul>
<p><strong>Compatibility (tested):</strong></p>
<ul>
<li>Chrome 12+</li>
<li>Firefox 8+</li>
<li>Opera 11+</li>
</ul>
<p><em>[/update]</em></p>
<p><strong>Demo:</strong><br />
<a href="http://dev.rogeriolino.com/js/vscroller.html" title="vScroller - Demo">http://dev.rogeriolino.com/js/vscroller.html</a></p>
<div class="shr-publisher-461"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F01%2F23%2Fjquery-vertical-scroller-plugin%2F' data-shr_title='jQuery%3A+Vertical+Scroller+Plugin'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F01%2F23%2Fjquery-vertical-scroller-plugin%2F' data-shr_title='jQuery%3A+Vertical+Scroller+Plugin'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2012%2F01%2F23%2Fjquery-vertical-scroller-plugin%2F' data-shr_title='jQuery%3A+Vertical+Scroller+Plugin'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2012/01/23/jquery-vertical-scroller-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quickpost: Instant documentation search</title>
		<link>http://rogeriolino.com/2011/12/07/quickpost-instant-documentation-search/</link>
		<comments>http://rogeriolino.com/2011/12/07/quickpost-instant-documentation-search/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 14:47:27 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Quickpost]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[dochub]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[instant]]></category>
		<category><![CDATA[mdn]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[quickpost]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=397</guid>
		<description><![CDATA[<p><a href="http://dochub.io/"></a></p> <p><a title="dochub" href="http://dochub.io/">dochub</a> concentra de maneira fácil e rápida as documentações de CSS, HTML, Javascript e DOM. No qual tem o seu conteúdo retirado da <a title="MDN" href="https://developer.mozilla.org/en-US/">Mozilla Developer Network</a>.</p> <p>Excelente ferramente para tirar aquela dúvida ou refrescar a memória.</p> <a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F07%2Fquickpost-instant-documentation-search%2F' data-shr_title='Quickpost%3A+Instant+documentation+search'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F07%2Fquickpost-instant-documentation-search%2F' data-shr_title='Quickpost%3A+Instant+documentation+search'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://dochub.io/"><img class="size-full wp-image-407" title="dochub" src="http://rogeriolino.com/wp-content/uploads/2011/12/dochub.png" alt="" width="840" height="450" /></a></p>
<p><a title="dochub" href="http://dochub.io/">dochub</a> concentra de maneira fácil e rápida as documentações de CSS, HTML, Javascript e DOM. No qual tem o seu conteúdo retirado da <a title="MDN" href="https://developer.mozilla.org/en-US/">Mozilla Developer Network</a>.</p>
<p>Excelente ferramente para tirar aquela dúvida ou refrescar a memória.</p>
<div class="shr-publisher-397"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F07%2Fquickpost-instant-documentation-search%2F' data-shr_title='Quickpost%3A+Instant+documentation+search'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F07%2Fquickpost-instant-documentation-search%2F' data-shr_title='Quickpost%3A+Instant+documentation+search'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F07%2Fquickpost-instant-documentation-search%2F' data-shr_title='Quickpost%3A+Instant+documentation+search'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2011/12/07/quickpost-instant-documentation-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickpost: Javascript Resource Loader</title>
		<link>http://rogeriolino.com/2011/12/05/quickpost-javascript-resource-loader/</link>
		<comments>http://rogeriolino.com/2011/12/05/quickpost-javascript-resource-loader/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 19:55:32 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Quickpost]]></category>
		<category><![CDATA[loader]]></category>
		<category><![CDATA[modernizr]]></category>
		<category><![CDATA[quickpost]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[yepnope]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=390</guid>
		<description><![CDATA[<p><a href="http://yepnopejs.com/" title="yepnope.js">yepnope</a> is an asynchronous conditional resource loader that&#8217;s super-fast, and allows you to load only the scripts that your users need.</p> <p>Good Things</p> yepnope.js is only 1.6kb &#8211; smaller than most and certainly a good size for its functionality set. yepnope.js is called a &#8220;resource loader&#8221; because it can work with both JavaScript [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><blockquote><p><a href="http://yepnopejs.com/" title="yepnope.js">yepnope</a> is an asynchronous conditional resource loader that&#8217;s super-fast, and allows you to load only the scripts that your users need.</p>
<p><strong>Good Things</strong></p>
<ul>
<li>yepnope.js is only 1.6kb &#8211; smaller than most and certainly a good size for its functionality set.</li>
<li>yepnope.js is called a &#8220;resource loader&#8221; because it can work with both JavaScript and CSS.</li>
<li>yepnope.js has a full test suite in QUnit that you can run in your set of supported browsers to make sure it works. (We run it via TestSwarm in every browser we can get our hands on)</li>
<li>yepnope.js fully decouples preloading from execution. This means that you have ultimate control of when your resource is executed and you can change that order on the fly.</li>
<li>The yepnope.js api is friendly and encourages logical grouping of resources.</li>
<li>yepnope.js is modular. It has a whole system for adding your own functionality and a couple examples of how you might do that. (Prefixes and filters).</li>
<li>The yepnope.js api encourages you to only load the resources that you need. This means that even when it&#8217;s slower than another script loader, it still can come out on top, because you could avoid an entire resource.</li>
<li>yepnope.js is integrated into <a href="http://www.modernizr.com/" title="Modernizr">Modernizr</a>.</li>
<li>yepnope.js always executes things in the order they are listed. This is a pro for some, and a con for others. We think it&#8217;s a friendly default.</li>
<li>yepnope.js has the capability to do resource fallbacks and still download dependent scripts in parallel with the first.</li>
</ul>
</blockquote>
<div class="shr-publisher-390"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F05%2Fquickpost-javascript-resource-loader%2F' data-shr_title='Quickpost%3A+Javascript+Resource+Loader'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F05%2Fquickpost-javascript-resource-loader%2F' data-shr_title='Quickpost%3A+Javascript+Resource+Loader'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F12%2F05%2Fquickpost-javascript-resource-loader%2F' data-shr_title='Quickpost%3A+Javascript+Resource+Loader'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2011/12/05/quickpost-javascript-resource-loader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Manga Framework</title>
		<link>http://rogeriolino.com/2011/09/20/php-manga-framework/</link>
		<comments>http://rogeriolino.com/2011/09/20/php-manga-framework/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 18:35:56 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[facelets]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[lithium]]></category>
		<category><![CDATA[manga]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[playframework]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[vraptor]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=364</guid>
		<description><![CDATA[<p>Criado o projeto para o framework <a href="https://github.com/rogeriolino/manga-framework" title="Manga Framework">Manga, no Github</a> (PHP 5.3+).</p> <p>Entre algumas funcionalidades, destaca-se o seu template engine baseado no <a href="http://facelets.java.net/" title="Facelets">Facelets</a>.</p> <p>Os arquivos de configuração poderão ser escritos em mais de um formato, inicialmente suporte a XML e YAML. Annotations são utilizadas para enxugar esses arquivos de configuração, deixando [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Criado o projeto para o framework <a href="https://github.com/rogeriolino/manga-framework" title="Manga Framework">Manga, no Github</a> (PHP 5.3+).</p>
<p>Entre algumas funcionalidades, destaca-se o seu template engine baseado no <a href="http://facelets.java.net/" title="Facelets">Facelets</a>.</p>
<p>Os arquivos de configuração poderão ser escritos em mais de um formato, inicialmente suporte a XML e YAML. Annotations são utilizadas para enxugar esses arquivos de configuração, deixando o código mais intuitivo.</p>
<p>O próximo passo é implementar suporte à <a href="http://en.wikipedia.org/wiki/Inversion_of_control" title="Inversion of Control">IoC</a>, que inicialmente pode ser simulado pelo arquivo de configuração de rotas (com suporte <a href="http://en.wikipedia.org/wiki/Representational_state_transfer" title="Representational State Transfer">REST</a>).</p>
<p>A intenção não é desenvolver um framework revolucionário, e sim adaptar as ideias e metodologias já utilizadas por outros em um único framework afim de aumentar a produtividade. Servem como inspiração os seguintes frameworks:</p>
<p><strong>Ruby</strong></p>
<ul>
<li><a href="http://rubyonrails.org/" title="Ruby on Rails">RoR</a></li>
</ul>
<p><strong>Java</strong></p>
<ul>
<li><a href="http://javaserverfaces.java.net/" title="Java Server Faces">JSF2</a></li>
<li><a href="http://www.springsource.org/" title="Spring">Spring 3</a></li>
<li><a href="http://vraptor.caelum.com.br/" title="VRaptor">VRaptor</a></li>
<li><a href="www.playframework.org" title="Play Framework">Play Framework</a></li>
</ul>
<p><strong>PHP</strong></p>
<ul>
<li><a href="http://lithify.me/" title="Lithium">Lithium</a></li>
<li><a href="http://symfony.com/" title="Symfony">Symfony</a></li>
<li><a href="http://www.yiiframework.com/" title="Yii">Yii</a></li>
</ul>
<div class="shr-publisher-364"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F09%2F20%2Fphp-manga-framework%2F' data-shr_title='PHP%3A+Manga+Framework'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F09%2F20%2Fphp-manga-framework%2F' data-shr_title='PHP%3A+Manga+Framework'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F09%2F20%2Fphp-manga-framework%2F' data-shr_title='PHP%3A+Manga+Framework'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2011/09/20/php-manga-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP: Layout Inheritance</title>
		<link>http://rogeriolino.com/2011/03/16/cakephp-layout-inheritance/</link>
		<comments>http://rogeriolino.com/2011/03/16/cakephp-layout-inheritance/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 18:37:26 +0000</pubDate>
		<dc:creator>Rogério Alencar Lino Filho</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[dica]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://rogeriolino.com/?p=356</guid>
		<description><![CDATA[<p>Para quem está utilizando o CakePHP ou já utilizou e também sentiu falta de herança nos layouts. Segue abaixo uma dica para ajudar na criações de templates utilizando o CakePHP.</p> &#60;?php // sublayout.ctp ob_start(); ?&#62; &#60;?php eco $content_for_layout; ?&#62; &#60;?php $content = ob_get_contents(); ob_end_clean(); echo $this->renderLayout( $content, 'default' // parent layout ); &#60;?php // controller [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Para quem está utilizando o CakePHP ou já utilizou e também sentiu falta de herança nos layouts. Segue abaixo uma dica para ajudar na criações de templates utilizando o CakePHP.</p>
<pre name="code" class="php">
&lt;?php
// sublayout.ctp

ob_start();

?&gt;
 <!-- html content -->
 &lt;?php eco $content_for_layout; ?&gt;
 <!-- html content -->
&lt;?php

$content = ob_get_contents();
ob_end_clean();

echo $this->renderLayout(
        $content,
        'default' // parent layout
);
</pre>
<pre name="code" class="php">
&lt;?php
// controller class
class MyController extends AppController {

    function test() {
        $this->layout = 'sublayout';
    }

}
</pre>
<div class="shr-publisher-356"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F03%2F16%2Fcakephp-layout-inheritance%2F' data-shr_title='CakePHP%3A+Layout+Inheritance'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F03%2F16%2Fcakephp-layout-inheritance%2F' data-shr_title='CakePHP%3A+Layout+Inheritance'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Frogeriolino.com%2F2011%2F03%2F16%2Fcakephp-layout-inheritance%2F' data-shr_title='CakePHP%3A+Layout+Inheritance'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://rogeriolino.com/2011/03/16/cakephp-layout-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

