News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

PHP in Action Blog:
Testing a Zend Framework action controller with View Helpers
June 11, 2008 @ 07:56:11

On the PHP in Action blog, there's a new post about a method for testing a controller as a part of a Zend Framework application with its own view helpers.

I came across a Zend Framework (ZF) example I wanted to refactor. You really have to have unit test coverage to refactor effectively, and since there were no tests, I started trying to find out how to test it. There didn't seem to be a wealth of information available on the web, so I've tried to figure it out by myself.

He walks through the testing process he followed - making some new default objects (for SimpleTest) and, using the flash messenger view helper, makes some mock classes to simulate sending the flash messages in an application.

0 comments voice your opinion now!
zendframwork simpletest unittest controller view helper



Stefan Mischook's Blog:
Note to CodeIgniter nerds please, no looping code in your views.
June 06, 2008 @ 08:43:53

Stefan Mischook so eloquently expresses his opinion on a method for looping in the CodeIgniter framework in this new post to the KillerPHP blog today, "Note to CodeIgniter nerds: please, no looping code in your views."

I was researching things 'nerd' on the Web today, and I found myself at the CodeIgniter website. [...] I'm wondering about CodeIgniter's decision to place PHP looping code in their views.

He notes that the whole point of the View in the Model/View/Controller framework is to keep as much PHP out of it as possible. In their example they show just the opposite. Some of the comments agree with his post, noting that this is in fact the point of the View. Others, however, point out that code in the View, especially looping code is something necessary to output multiple items being passed out.

0 comments voice your opinion now!
codeigniter view framework loop code output


Zend Developer Zone:
View Helpers in Zend Framework
April 29, 2008 @ 14:38:27

The Zend Developer Zone has posted a new tutorial (from Matthew Weier O'Phinney) about a handy feature of the Zend Framework's view layer - view helpers that can be added in and reused across an application to do some pretty cool stuff.

A View Helper is simply a class that follows particular naming conventions, When attached to a view object, you can call the helper as if it were a method of the view object itself. The View object retains helper instances, which means that they retain states between calls.

View helpers can be use to do things like manipulate view data for more complex operations and carrying over data between two views, limiting the number of fetches that have to be done. He shows how to create a simple helper - My_Helper_FooBar - that just appends "fooBar " to whatever's passed in. He also talks about some of the default view helpers (like form fields), partials, the doctype() helper, capturing/caching content to be used later and the use of placeholders.

0 comments voice your opinion now!
zendframework view helper form partial doctype capture placeholder


Padraic Brady's Blog:
An Example Zend Framework Blog App - Part 3 A Simple Hello World Tutorial
April 29, 2008 @ 12:57:56

Padraic Brady has posted part three in his look at making a blogging application with the Zend Framework. This time get gets down and gets into the code.

It's almost obligatory when introducing a new programming topic, that the author present the simplest possible example. Usually this means getting a programming language or framework to print "Hello World" to the screen. I'm going to be no different. So much for originality...

He shows how to set up everything, down to the Apache VirtualHost directive and hosts file to get the web server and localhost working correctly. He includes the code for the boostrap file and how to create your first controller (along with its view, of course).

0 comments voice your opinion now!
zendframework helloworld tutorial blog controller view bootstrap


Michael Girouard's Blog:
Rolling Your Own MVC The View
April 28, 2008 @ 09:39:45

Michael is back with part three of his series stepping you through the creation of your own MVC framework (Part 1 and Part 2) with a look at the part that interfaces with the user - the View.

Using the view as a starting point may seem odd at first considering the view-related actions are some of the last steps in the page load scenario, but since our views don't have any external dependencies, unit tests are very easy to write and so is the accompanying code.

He explains how views work along with the rest of the framework and some of the basic rules surrounding how they get their data. Code comes along with the explanations for different views like XML, HTML and JSON methods of output.

0 comments voice your opinion now!
modelviewcontroller mvc view tutorial output xml html json


Hasin Hayder's Blog:
Getting started with orchid framework
April 08, 2008 @ 13:01:47

Hasin Hayder has blogged about some of his "first steps" with a relatively new PHP framework on the scene - Orchid.

Orchid is a small framework with bare necessities to kick start developing killer php web applications. this framework is not flooded with unnecessary features and libraries. it only contains the essential helpers and libraries to boost up your development, not slowing it down. orchid features a very short learning curve, which will keep you trouble free.

He documents the step he followed - downloading the latest release (from the svn repository), making a first controller and adding a view to make his first "hello world" application.

0 comments voice your opinion now!
orchidframework beginner tutorial controller view example


Chris Hartjes' Blog:
"My framework is more MVC than *your* framework!"
March 07, 2008 @ 08:45:00

Chris Hartjes has posted about a topic, while not new in the PHP community it seems to have resurfaced more lately - how MVC is implemented (or not implemented) in most of the PHP-based Rails-esque frameworks.

This guy [making comments at PHP London] apparently works for the Agavi project. [...] The comments for that [reddit] post are really interesting too, as people take their usual swipes at PHP, and CakePHP, and the Symfony guys come out in droves to talk up Symfony, and on and on it goes. Sadly, this is not a unique occurance on the web.

Chris took a closer look at Agavi to see what made its MVC so special - only to find that it just does it different, but not necessarily "right" (he includes a code example to illustrate). He also quotes Wikipedia's definition of an MVC framework and notes that CakePHP seems to fit it to a tee.

0 comments voice your opinion now!
mvc model view controller framework agavi cakephp


Rob Allen's Blog:
A View Stream with Zend_View
February 07, 2008 @ 07:58:17

Rob Allen has posted about a small modification that he made to his Zend Framework setup that allows for a little safer echoing of information out to the View later of an application.

One of my biggest issues with using PHP as the templating engine in View scripts is that the easiest way to echo a variable is the least secure. [...] So, I decided to leverage a post by Mike Naberezny from a while ago about streams. The idea is all his; I just modified it to work with Zend Framework's Zend_View the way I wanted it to.

His method uses a slightly different output format - instead of using a normal echo statement to push out the escaped output, it uses a special syntax using the "@" sign as a shortcut to the call to escape(). He includes the code you'll need to make it work in your ZF install and explain it a bit (including where the real key lies - in stream_popen).

0 comments voice your opinion now!
zendframework stream zendview escape custom output view


KillerPHP.com:
Zend Framework Using View Helpers to Build Rich, Scalable, Controls
January 31, 2008 @ 12:03:00

This new post from Jon Lebensold (on the KillerPHP blog) introduces you to a handy feature of the Zend Framework - View Helpers.

In summary, View Helpers are great for encapsulating forms, grids and other functionality that could eventually be bound to a different data source or even be pushed back to the user through a simple AJAX call.

Example code on how to use them is included showing a sample helper that adds Ajax functionality to a form's submit and pushes the response values back out into a div on the page.

0 comments voice your opinion now!
zendframework view helper ajax example code


Rob Allen's Blog:
Where to set up your view?
December 10, 2007 @ 11:13:00

In a new post Rob Allen takes a look at working with the Zend Framework, specifically with his Views. He presents his method for doing layouts in anticipation of the Zend_Layout package.

With Zend_Layout on the horizon, I've been looking at how to use it and it will remove the need for my own front controller plugin which I call SiteTemplate. As a result, I need to find a new home for the view customisation stuff I do in SiteTemplate.

He presents two options - one is a front controller that abstracts off the setup of the view before the Layout component gets a hold of it and the other places the creation of the view into the bootstrap file as a helper. He wants your input as to which method might better (or if there's something else you can think of).

0 comments voice your opinion now!
zendframework view helper controller bootstrap zendframework view helper controller bootstrap



Community Events











Don't see your event here?
Let us know!


zend release framework security PEAR zendframework job PHP5 application releases code mysql ajax book cakephp package developer conference example database

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework