Solve the problem. Just it!

These days I’m thinking about productivity and the use of PHP frameworks. I’ve read some posts about framework X or Y, defending a framework instead of another one.

I know people that use a framework like Zend Framework to develop a simple website just to say they’re using it, and not an “easy” framework. I think you must to solve the problem, not create another one. You have to use best practices but first you have to solve the problem, nothing more.

You don’t have to use a hard-to-learn framework just to say your friends you know about it. You can do amazing things with easy-to-learn frameworks, like Code Igniter, CakePHP, Laravel or Slim. You can do better even with pure PHP if you want, but you have to concern about productivity (and security of course).

Continue reading Solve the problem. Just it!

Creating new Zend Framework project using Zend_Tool

Hello.

Another quick tip. To start a new Zend Framework project, the easiest way is using Zend_Tool for that. Please, install first the Zend_Tool follow this link at Zend Framework documentation page.

Creating new project

Let’s starting using the command line and creating a new ZF project.

zf create project my_project_name

Zend_Layout

Now, get in the project folder and enable Zend_Layout support:

cd my_project_name
zf enable layout

Continue reading Creating new Zend Framework project using Zend_Tool

Pre and post database operations with Zend Framework using Zend_Db_Table_Row

Hi all.

Here I am again.

Today I have a quick tip for beginners using Zend Framework.

Do not insert pre and post code (for database) in your Controller. The Zend_Db_Table_Row is for that.

Lets create our DatabaseTable class for Posts:

/**  
* Located in .../models/DbTable/Posts.php  
*/  
class Posts extends Zend\_Db\_Table_Abstract  
{
    protected $_primary = 'id';  
    protected $_name = 'posts';  
    protected $_rowClass = 'Post'; // here we linked the Post class above  
}

Continue reading Pre and post database operations with Zend Framework using Zend_Db_Table_Row

Deploying Zend Framework applications on a shared host

Hello everybody!

Usually I have direct access (shell) in all the servers that host my Zend Framework applications, but, some clients already have a shared host, so I have to deploy the application there too.

I was thinking how can I never thought this before! There are a lot of ways to deploy a Zend Framework application, but in a shared host we can’t have access to create Virtual Hosts on Apache.

Continue reading Deploying Zend Framework applications on a shared host

Zend Framework vs CakePHP Framework

Hi every one!

I just read a small but very interesting post in BrownPHP website with a comparison between Zend Framework and CakePHP Framework. The post is below and the original article is here.

The Zend Framework, developed by Zend Technologies is an open-source, object oriented web-application framework implemented in PHP 5. It is widely known as ZF and is developed with the purpose of making things easier for PHP developers and supporting best practices at the same time. CakePHP too, is an open-source web application framework used for creating web applications written in PHP. It is developed by Cake Software Foundation, Inc. It is written in PHP and is based on the model of Ruby on Rails.

Zend Framework has easy methods of licensing with the new BSD license and a swift and well-tested code base that your business can rely upon. It makes use of commonly available APIs from well known vendors like Google, Amazon, Yahoo!, Flickr and API providers and catalogers such as StrikeIron and Programmable Web.  Continue reading Zend Framework vs CakePHP Framework

Basic CRUD operations with Zend Framework

Hi everyone,

Here I am again. Yesterday a friend asked me how to create the basics CRUD (Create, Release, Update, Delete) operations using Zend Framework. As everybody now, a basic CRUD it’s a good way to understand some framework’s resources to a new ZF developer. As he is a newbie with Zend Framework, the example will be simpler, but complete.

I think this example resumes a lot of things of a basic usage of Zend Framework, like controllers, models – not exactly ;-), views and the magic Zend_Form, with form validation, filters and more.

Our application context will be a simple Blog using MySQL as database. Why blog again? Because it’s simple to understand, just it. Our blog application will have just the posts table, to show only the CRUD funcionallity. Comments and files can be reason to a future post.

Continue reading Basic CRUD operations with Zend Framework

jQuery Form plugin does not send XMLHttpRequest value

Hi all…

Here we are, again.

This will be a quick post, just for warning in a specific case. When you’re using the jQuery Form plugin by malsup.com you are making an AJAX call, but it does not send some variables that identify a XMLHttpRequest (in my case I’m using the plugin with a upload form).

Continue reading jQuery Form plugin does not send XMLHttpRequest value

Utilizando AjaxContext para chamadas Ajax com Zend Framework

Olá pessoal!

Esta semana estou trabalhando num projeto onde a utilização de Ajax está sendo muito útil em termos de performance e facilidade na busca de produtos no banco de dados.

Como estou utilizando Zend Framework no projeto, vou explicar resumidamente como trabalhar com requisições Ajax no ZF.

Basicamente, o óbvio seria desabilitar a renderização da view por padrão em sua action e também desabilitar o layout, caso esteja usando-o.

Continue reading Utilizando AjaxContext para chamadas Ajax com Zend Framework

Tradução usando gettext (*.mo) no Poedit

Olá pessoal.

Indo direto ao assunto, sempre tive dúvidas quanto a usar o Poedit para traduzir strings, motivo pelo qual usava mais arrays em PHP mesmo. Porém, mais cedo ou mais tarde, necessitamos evoluir e correr atrás do tempo perdido.

Sempre achei o Poedit chato e nunca conseguia fazê-lo funcionar. Após umas fuçadas na net e acertar o link correto, consegui (e entendi :-)) seu funcionamento.

Continue reading Tradução usando gettext (*.mo) no Poedit