<?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>Carlos André Ferrari &#187; vortice</title>
	<atom:link href="http://ferrari.eti.br/tag/vortice/feed/" rel="self" type="application/rss+xml" />
	<link>http://ferrari.eti.br</link>
	<description>php, python, xhtml, html5, css, javascript, jquery, webstandards, linux, nginx</description>
	<lastBuildDate>Thu, 29 Jul 2010 10:05:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Autenticação de Usuários no Vórtice PHP</title>
		<link>http://ferrari.eti.br/autenticacao-de-usuarios-no-vortice-php/</link>
		<comments>http://ferrari.eti.br/autenticacao-de-usuarios-no-vortice-php/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 19:02:57 +0000</pubDate>
		<dc:creator>caferrari</dc:creator>
				<category><![CDATA[vortice]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ferrari.eti.br/?p=71</guid>
		<description><![CDATA[Nesse post vou explicar como adicionar autenticação de usuários no @vorticephp, como base para o sistema vamos utilizar o exemplo que já vem com o framework.
Script de BD:

CREATE TABLE IF NOT EXISTS orgaos &#40;
id int&#40;11&#41; NOT NULL AUTO_INCREMENT,
sigla varchar&#40;50&#41; collate utf8_unicode_ci NOT NULL,
nome varchar&#40;150&#41; collate utf8_unicode_ci NOT NULL,
PRIMARY KEY  &#40;id&#41;
&#41; ENGINE=MyISAM  DEFAULT CHARSET=utf8
&#160;
CREATE TABLE IF [...]]]></description>
			<content:encoded><![CDATA[<p>Nesse post vou explicar como adicionar autenticação de usuários no <a href="http://twitter.com/vorticephp">@vorticephp</a>, como base para o sistema vamos utilizar o exemplo que já vem com o framework.</p>
<p>Script de BD:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <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> orgaos <span style="color: #66cc66;">&#40;</span>
id int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <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>
sigla varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span> collate utf8_unicode_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
nome varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #66cc66;">&#41;</span> collate utf8_unicode_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <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> usuarios <span style="color: #66cc66;">&#40;</span>
id int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
nome varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
email varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
senha char<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> usuarios <span style="color: #66cc66;">&#40;</span>nome<span style="color: #66cc66;">,</span> email<span style="color: #66cc66;">,</span> senha<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Administrador'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'adm@ferrari.eti.br'</span><span style="color: #66cc66;">,</span> md5<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'123'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>eu criei essa tabela com esse usuario e senha no database que já vem configurado no framework para vocês testarem localmente. Você pode configurar a conexão com o seu próprio banco de dados no arquivo app/app.php</p>
<p>Para iniciar vamos criar o objeto do usuário em: app/model/Usuario.php e codificar:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> Usuario<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nome</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$senha</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nome</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nome</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">senha</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$senha</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>agora que temos o objeto, vamos criar um DAO para realizar operações, crie o arquivo app/model/UsuarioDAO.php e segue o código:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> UsuarioDAO<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getByEmail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM usuarios WHERE email='<span style="color: #006699; font-weight: bold;">$email</span>'&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> Database<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">queryOne</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>vamos para o controller de usuários, crie o arquivo app/controller/UsuarioController.php e segue o codigo inicial:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> UsuarioController <span style="color: #000000; font-weight: bold;">extends</span> Controller<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Dai a gente cria o nosso formulário de login, edite app/view/usuario/login.php:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;h2&gt;Login&lt;/h2&gt;
&lt;fieldset&gt;
	&lt;form method=&quot;post&quot;&gt;
		&lt;p&gt;&lt;label&gt;E-mail:&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;email&quot; /&gt;&lt;/p&gt;
		&lt;p&gt;&lt;label&gt;Senha:&lt;/label&gt;&lt;input type=&quot;password&quot; name=&quot;senha&quot; /&gt;&lt;/p&gt;
		&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Logar!&quot; /&gt;&lt;/p&gt;
	&lt;/form&gt;
&lt;/fieldset&gt;</pre></div></div>

<p>Agora com o form criado, vamos editar a action login do controller Usuario, volte e edite o arquivo app/controller/UsuarioController.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> UsuarioController <span style="color: #000000; font-weight: bold;">extends</span> Controller<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// se um formulario foi postado</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>post<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// pega as variáveis do post</span>
			<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #990000;">addslashes</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$senha</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'senha'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// seleciona o usuario, armazena na variavel $u</span>
			<span style="color: #666666; font-style: italic;">// e ainda verifica se o usuario existe</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$u</span> <span style="color: #339933;">=</span> UsuarioDAO<span style="color: #339933;">::</span><span style="color: #004000;">getByEmail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// verifica se a senha digitada combina com</span>
				<span style="color: #666666; font-style: italic;">// a que está no BD</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$u</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">senha</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$senha</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// remove a senha do objeto</span>
					<span style="color: #000088;">$u</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">senha</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
					<span style="color: #666666; font-style: italic;">// grava a session</span>
					Session<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$u</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #666666; font-style: italic;">// Cria mensagem de sucesso e redireciona para o index</span>
					Post<span style="color: #339933;">::</span><span style="color: #004000;">setSucesso</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Olá <span style="color: #006699; font-weight: bold;">{$u-&gt;nome}</span>, você está logado&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #990000;">Link</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span>
					<span style="color: #666666; font-style: italic;">// Retorna erro</span>
					Post<span style="color: #339933;">::</span><span style="color: #004000;">setErros</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Senha incorreta!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span>
				<span style="color: #666666; font-style: italic;">// Retorna erro</span>
				Post<span style="color: #339933;">::</span><span style="color: #004000;">setErros</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;e-mail não encontrado!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Para ficar bonita a url vamos criar um route para esta action, edite o arquivo app/routes.php e adicione:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Route<span style="color: #339933;">::</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^login$&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;usuario:login&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Agora o formulário de login já está funcionando, vamos fazer o sistema obrigar o usuario estar logado para fazer qualquer coisa no sistema, para isso edite o arquivo app/controller/MasterController.php, como queremos que para todo o sistema sejá necessário o login, vamos adicionar um construtor nessa classe com o seguinte código:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// se a session &quot;u&quot; não existir, criar uma com um usuario vazio</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>Session<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> Session<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> Usuario<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Se a session u tiver um objeto vazio..</span>
	<span style="color: #666666; font-style: italic;">// e o controller/action forem diferentes dos de login</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>Session<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> controller <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'usuario'</span> <span style="color: #339933;">&amp;&amp;</span> action <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// redireciona para a tela de login</span>
		redirect<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #990000;">Link</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Bom, com isso já deve estar tudo funcionando de forma eficiente e simples. Qualquer dúvida ou sugestão mande sem hexitar.</p>
]]></content:encoded>
			<wfw:commentRss>http://ferrari.eti.br/autenticacao-de-usuarios-no-vortice-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Vórtice PHP Framework &#8211; Introdução</title>
		<link>http://ferrari.eti.br/vortice-php-framework-introducao/</link>
		<comments>http://ferrari.eti.br/vortice-php-framework-introducao/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:55:38 +0000</pubDate>
		<dc:creator>caferrari</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[vortice]]></category>

		<guid isPermaLink="false">http://ferrari.eti.br/?p=63</guid>
		<description><![CDATA[Assim como frameworks mais conhecidos, o Vórtice tem uma estrutura de pastas que visa organizar todo o sistema e facilitar na hora da reutilização de código. segue abaixo a estrutura:
1 - app
1.1 - classes
1.2 - controller
1.2 - model
1.3 - view
1.4 - error_docs
1.5 - i18n
1.6 - plugins
2 - core
3 - css
4 - js
5 - templates
5.1 - [...]]]></description>
			<content:encoded><![CDATA[<p>Assim como frameworks mais conhecidos, o <a href="http://vortice.googlecode.com">Vórtice</a> tem uma estrutura de pastas que visa organizar todo o sistema e facilitar na hora da reutilização de código. segue abaixo a estrutura:</p>
<pre>1 - app
1.1 - classes
1.2 - controller
1.2 - model
1.3 - view
1.4 - error_docs
1.5 - i18n
1.6 - plugins
2 - core
3 - css
4 - js
5 - templates
5.1 - nome_do_seu_template
5.1.1 - css
5.1.2 - js</pre>
<h3>1 &#8211; App</h3>
<p>Apesar do framework não exigir nenhuma configuração em ambientes Linux/Unix ele possui um arquivo config.php que é necessário ser usado em caso de instalação em um ambiente Windows para definir a pasta fisica e a pasta virtual do sistema. ainda na pasta app existem os arquivos app.php e funcoes.php, que podem ser utilizados para inicializar instâncias de bancos de dados, criar funções e fazer qualquer coisa que você venha a precisar globalmente no seu site. Aqui também existe o arquivo route.php onde você poderá criar rotas baseadas em expressões regulares, tem um exemplo comentado de como funciona no sistema de exemplo.</p>
<h3>1.1 &#8211; classes</h3>
<p>Essa é a pasta de helpers, coloque ai suas classes de Segurança, as que modificam o fluxo do framework e qualquer classe que você venha a precisar no seu sistema</p>
<h3>1.2 &#8211; controller</h3>
<p>Pasta onde ficam os controllers, o nome do arquivo deve ser: CarroController.php, contendo dentro uma classe CarroController extendondo a classe Controller do framework. cada metodo dessa classe será uma action.</p>
<h3>1.2 &#8211; model</h3>
<p>Modelos do sistema, cada model é constituido por dois arquivos: Carro.php e CarroDAO.php contendo cada um a respectiva classe dentro. A classe Carro guarda a classe de um unico objeto carro (pode extender a classe de framework DTO) e a classe CarroDAO (quepode extender a classe de framework DAO) contêm as operações relacionadas ao objeto Carro (insert, delete, list, etc)</p>
<h3>1.3 &#8211; view</h3>
<p>Views do sistemas, uma view é um arquivo .php que será colocado dentro do template após a execução (substituindo o comentario &lt;!&#8211;conteudo&#8211;&gt; dentro do framework). Cada view deve ser colocada em uma subpasta com o nome do controller que ela pertence: app/view/carro/listar.php e será carregada automaticamente após a action listar do controller carro.</p>
<h3>1.4 &#8211; error_docs</h3>
<p>Páginas de erro, no framework já vem dois modelos.</p>
<h3>1.5 &#8211; i18n</h3>
<p>Pasta onde ficam traduções do sistema (en.conf, pt.conf, jp.conf, etc). Futuramente eu escrevo um post só sobre isso.</p>
<h3>1.6 &#8211; plugins</h3>
<p>Nessa pasta ficam plugins, que são executados exclusivamente antes da página ser enviada ao navegador. Futuramente eu escrevo sobre ela também.</p>
<h3>2 &#8211; core</h3>
<p>Aqui fica o nucleo do framework, caso você tenha vários sistemas usando ele, é possível criar um link simbólico e usar apenas uma pasta para todos os sites.</p>
<h3>3 &#8211; css</h3>
<p>Arquivos CSS globais, que serão carregados para todos os templates</p>
<h3>4 &#8211; js</h3>
<p>Arquivos JS globais, assim como a pasta css</p>
<h3>5 &#8211; templates</h3>
<p>Templates do site, cada subpasta será um template e dentro será necessário um arquivo template.php com o html básico da página.</p>
<h3>5.1.1 &#8211; css</h3>
<p>Aqui ficam os arquivos CSS exclusivos desse template</p>
<h3>5.1.2 &#8211; js</h3>
<p>Arquivos JS exclusivos do template</p>
<p>Fica ai toda a estrutura, qualquer dúvida deixe um comentário.</p>
<p>Faça já o download e experimente: <a href="http://vortice.googlecode.com">Projeto Vórtice PHP</a><br />
Siga o vórtice no twitter: <a href="http://twitter.com/vorticephp">@vorticephp</a> e acompanhe mais novidades seguindo <a href="http://twitter.com/caferrari">@caferrari</a> e <a href="http://twitter.com/luanlmd">@luanlmd</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ferrari.eti.br/vortice-php-framework-introducao/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Vórtice PHP Framework &#8211; Apresentação</title>
		<link>http://ferrari.eti.br/vortice-php-framework-apresentacao/</link>
		<comments>http://ferrari.eti.br/vortice-php-framework-apresentacao/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 10:42:47 +0000</pubDate>
		<dc:creator>caferrari</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[vortice]]></category>

		<guid isPermaLink="false">http://ferrari.eti.br/?p=51</guid>
		<description><![CDATA[Desde junho de 2008 eu e meus colegas do trabalho estamos desenvolvendo uma solução para usar nos sites do Governo do Tocantins e nos sistemas, como a gente tem problemas com a estrutura disponível (hardware!) decidimos criar um framework, que, além de agilizar nossa produção fosse extremamente rápido, consumisse o minimo de recursos possível e [...]]]></description>
			<content:encoded><![CDATA[<p>Desde junho de 2008 eu e meus colegas do trabalho estamos desenvolvendo uma solução para usar nos sites do Governo do Tocantins e nos sistemas, como a gente tem problemas com a estrutura disponível (hardware!) decidimos criar um framework, que, além de agilizar nossa produção fosse extremamente rápido, consumisse o minimo de recursos possível e permitisse o reaproveitamento de código.</p>
<p>Com menos de 2 meses de desenvolvimento, nascia o <a href="http://github.com/caferrari/vorticephp">Vórtice</a> junto com um <a href="http://faleconosco.to.gov.br">projeto inicial</a> que nos direcionou inicialmente no desenvolvimento.</p>
<p>Dentre as diversas características do framework, as mais importantes são:</p>
<ul>
<li> Velocidade;</li>
<li> Padrão MVC com Front Controller;</li>
<li>Rewrite de URL&#8217;s com suporte a regex;</li>
<li> Internacionalização com url&#8217;s únicas por idioma (queriamos que o google indexasse todas as línguas, ex: <a href="http://jalapao.to.gov.br">Jalapão</a>);</li>
<li>Ferramentas para mensagens de erro eficientes, tanto com ajax quanto sem;</li>
<li>O mínimo de configuração possível (no linux não exige nenhuma configuração!);</li>
<li>Fosse possível se conectar em multiplos bancos de dados;</li>
<li>PDO!</li>
<li>Pronto para funcionar com Ajax;</li>
<li>Nos desse algo para trabalhar com versões mobile dos sites;</li>
<li>Renderização em HTML, Json, XML, phpserialize, etc..</li>
</ul>
<p>Veja as demais características no <a href="http://github.com/caferrari/vorticephp">site do projeto</a>.</p>
<p>O projeto quase não foi divulgado devido a falta de Documentação, porém, hoje, como ele está extremamente estável decidi criar este post para apresentá-lo. caso você queira testar, é só <a href="http://github.com/caferrari/vorticephp">baixar</a> e brincar. Ele já vem com um projeto de exemplo que ajuda a ter uma noção legal das funcionalidades.</p>
<p>Para finalizar alguns projetos usando ele:</p>
<ul>
<li><a href="http://to.gov.br">http://to.gov.br</a></li>
<li><a href="http://jalapao.to.gov.br">http://jalapao.to.gov.br</a></li>
<li><a href="http://secom.to.gov.br">http://secom.to.gov.br</a></li>
</ul>
<p>Aguardo comentários.</p>
]]></content:encoded>
			<wfw:commentRss>http://ferrari.eti.br/vortice-php-framework-apresentacao/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
