News Feed
Sections

News Archive
feed this:

PHPImact Blog:
Refactoring the Front Controller of the Zend Framework
August 20, 2008 @ 14:04:01

The PHP::Impact blog has a new tutorial posted today with a look at a refactoring of the front controller of the Zend Framework to make it a bit more manageable.

One of the most fundamental decision in object design is deciding where to put responsibilities. No one, and I mean no one, gets it right the first time. That's why refactoring is so important. As Kent Beck puts it, refactoring is the process of taking a system and adding to its value, not by changing its behaviour but by giving it more of these qualities that enable us to continue developing at speed.

He follows the "extract" refactoring method that makes things simpler by removing unneeded parts of the code (in favor of an interchangeable external "extract class". He removes seven methods from the class and splits them off into their own. This reduces the controller down to a more manageable size and takes a lot of the complexity out.

0 comments voice your opinion now!
tutorial refactor extract class zendframework front controller



C7Y:
Practical Uses for the PHP Tokenizer
August 20, 2008 @ 09:31:55

A new tutorial has been posted to php|architects C7Y community site looking at some practical uses of the PHP tokenizer to work with your source.

In this article we take a look at the PHP tokenizer and its potential at analyzing and processing PHP source code. We will build several working examples, which you can start using and extending for your own purposes.

The author, Stan Vassilev, explains what the tokenizer is for, how it parses the code (via a lexer) and how to get at the tokens that are created. He uses the token_get_all and token_name functions to get the information and creates a wrapper class around them to strip whitespace and comments.

0 comments voice your opinion now!
tokenizer practical use tutorial strip whitespace filter class


DevShed:
Migrating Class Code for a MIME Email to PHP 5
August 07, 2008 @ 11:16:43

DevShed has finished off their series looking at sending MIME emails with PHP in this new tutorial, moving the current code from the previous parts up to a fully PHP5 state.

While this mailer class can be used with small PHP applications, it lacks some important features related specifically to its object model, since it was built in PHP 4 from the very beginning.

They review the PHP4 version of the script first then move on to the process of porting it to a more standardized PHP5 structure and code.

0 comments voice your opinion now!
mime email tutorial class php4 php5 migrate


CodeIgniter Blog:
CodeIgniter Community Voice - Generating PDF files using CodeIgniter
August 01, 2008 @ 08:45:55

The CodeIgniter blog has posted another Community Voice spotlight on one of its members. Thsi time they focus on Chris Monnat and his tutorial on creating PDF files with the CodeIgniter framework.

When generating reports in PDF format you suddenly have a lot more control over layout and design than you do with plain old HTML and CSS (although much progress is being made with print style sheets). You can create some really nice reports on the fly that your users can view, save for later or e-mail to their co-workers for review. In this post I will show you how I generate PDF reports using CodeIgniter.

You'll need this external library to get the PDF building to work, but integrating it with CodeIgniter is simple. It comes with its own interface you can use after making a cezpdf object. He shows you how to work with normal text, tabular data and inserting headers and footers for each page.

0 comments voice your opinion now!
chrismonnat pdf codeigniter framework tutorial ros class


Debuggable Blog:
Testing Models in CakePHP - Now let's get rid of the unnecessary ModelTest classes!
July 31, 2008 @ 07:51:38

On the Debuggable blog today Tim Koschutzki looks at another testing topics for the CakePHP framework - a cleaner way for testing models.

Up until now there was always a need to create a so-called test model that extends your model-under-test in order to overwrite its $useDbConfig setting to be 'test_suite'. By that you ensured that your models run with the test_suite datasource when the tests are run. [...] Nate proposed ClassRegistry::config(), which allows you to tell the ClassRegistry class which datasource it shall use when ClassRegistry::init() is used the next time (and thereby a model is instantiated).

He includes an example of the new functionality - a test case ensuring that three articles are there and are marked as published. The registry makes it easier to automatically create the ArticleTest instance inside the test case rather than having to manually declare and define it.

0 comments voice your opinion now!
test case cakephp framework registry modeltest class


DevShed:
A Better Way to Determine MIME Types for MIME Email with PHP
July 24, 2008 @ 07:53:18

Continuing on in their look at sending MIME emails with PHP, DevShed has posted a better way for you to determine the correct MIME type of the file you're wanting to send (third part of the series).

I demonstrated how to build a modular MIME mailer class in PHP 4; it was provided with the capacity to send messages in plain text, and to work with different types of file attachments. This class implements a private method, called "getMimeTypes()," which, as its name would suggest, comes in handy for determining the correct MIME type of a given file. [...] However, the logic implemented by this method is rather primitive and can definitely be improved.

They start with a review of the previous code (PHP4) and show how to get the correct mime type of the file based on the extension mapped to an array of types.

0 comments voice your opinion now!
mime tutorial type mail php4 class getmimetypes extension


Stefan Mischook's Blog:
How to call functions from another class
July 22, 2008 @ 12:06:24

Stefan Mischook has a (very) basic introduction video posted showing how to call functions/methods from another class outside the one you're currently using.

Recently I was asked by someone how they could call a function found in one class, in another. This may seem like basic stuff to those of us who know...but please keep in mind, at one time, none of us knew anything!

You can check out the video here. Be sure to check out more of the great videos he's created too on topics ranging from MVC frameworks to a beginner's guide to PHP.

0 comments voice your opinion now!
video tutorial call function class method


DevShed:
Handling Attachments in MIME Email with PHP
July 16, 2008 @ 12:58:17

DevShed has posted the second part of their series looking at handling MIME attachments in PHP generated emails today. This time they focus on the modification of their PHP4 class to make sending the emails easy.

In this second tutorial of the series, I'm going to teach you how to improve the initial structure of the MIME mailer class developed in the first article by giving it the ability to work directly with attachments. Sounds fairly interesting, right? Then don't waste any more time in preliminaries and begin reading this article now!

They refresh you on the code from the former tutorial and show you how to modify it to work with more than just the simple plain-text attachment like before (with binary information, things like JPEGs, PDFs and other text formats like XML and HTML).

0 comments voice your opinion now!
attachments mime email tutorial class


Matthew Turland's Blog:
Simplifying Zend_View_Helper_Url
July 14, 2008 @ 08:48:18

Matthew Turland has posted a quick tutorial where he aims to simplify some of the functionality that the Zend Framework's Zend_View_Helper_Url view helper has to offer.

When I first began working with Zend_View on a project at work, I noticed that the Url view helper was a bit of a pain to use. It was rare that I didn't want to specify one or more of the action, controller, and module in my call along with the other Route assembly parameters.

He wanted to be able to get around some limitations of the helper - use arrays to help label the calls more readable and to be able to refer to other actions in the same controller. He actually made another view helper, one that extends Zend_View_Helper_Url with a few optional parameters including the extra data he wanted in an array. You can see the code at the bottom of his post (he credits Andy Best with development on the idea too).

0 comments voice your opinion now!
zendframework viewhelper zendviewhelperurl url extend class


DevShed:
Sending MIME Email with PHP
July 10, 2008 @ 08:49:20

In this new tutorial on DevShed Alejandro Gervasio explains how to send emails from PHP with MIME payloads attached.

One of the most common tasks that a PHP programmer has to tackle is the development of applications that send MIME email in one form or another. In simple terms, MIME email consists of an extension of traditional email technology and comes in handy for sending email messages in fancy HTML and handling file attachments in a wide variety of formats.

In this first part of the series he just lays the groundwork - creating the mailer class they'll use for the series and using it to send a sample email (a basic message with a plain text MIME block).

0 comments voice your opinion now!
mime email tutorial payload class binary



Community Events











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


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

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