News Feed
Sections

News Archive
feed this:

Zend Developer Zone:
Three Quick Tips To Make Your PHP Understandable
June 25, 2008 @ 07:57:19

The Zend Developer Zone has posted a new article today with three tips to help you make your code a little easier to understand (both by other coders and yourself down the road).

Producing code that clearly conveys a developer's intent is key to any well written application. That not only applies to PHP, but every programming language. Developers who emphasize the creation of legible code tend to create applications which are easier to both maintain and expand upon.

His tips include suggestions about keeping conditional logic clean, using "less PHP and more HTML" and to make the best possible use that you can out of sprintf "and friends".

0 comments voice your opinion now!
tips understandable code conditional logic html sprintf



Maarten Balliauw's Blog:
Reuse Excel business logic with PHPExcel
May 06, 2008 @ 07:51:38

Maarten Balliauw has made a new blog post today about a method he's using to help reuse some of the business logic that Excel spreadsheets can have in a PHP script with help from PHPExcel.

In many companies, business logic resides in Excel. This business logic is sometimes created by business analysts and sometimes by business users who want to automate parts of their everyday job using Excel. [...] Did you know you can use PHPExcel to take advantage of the Excel-based business logic without having to worry about duplicate business logic?

He creates a quick example of a script that can take in an Excal file and pull it into a PHPExcel object, ready for manipulation. He fills in values for the already defined fields (like "carColor" or "leatherSeats") and uses the getCalculatedValue method to perform the action on the cell. The output is dropped into a variable that can be echoed out or used later on in the PHP script.

0 comments voice your opinion now!
phpexcel excel business logic reuse tutorial example


Community News:
patTemplate 3.1.0 stable released
June 04, 2007 @ 08:45:00

The PAT group has released the latest version of their popular templating library - patTemplate 3.1.0 stable.

After two years of development we finally released patTemplate 3.1.0 as a stable version. The changes since the last beta release are minimal. You can read about all changes since the last stable release in the changelog. patTemplate can be downloaded from our PEAR channel server or easily installed via the PEAR installer.

The patTemplate system helps developers separate out the business logic from the layout and content of their site to make maintenance easier for both the designer and the developer.

0 comments voice your opinion now!
pattemplate release stable template business presentation logic pattemplate release stable template business presentation logic


LoLoCoJr Blog:
Rewriting a (large) PHP application in Rails, part 2
December 20, 2006 @ 10:17:00

The LoLoCoJr site has published part two of the series (part one is here) about converting a PHP application over to Rails.

In my previous post on this topic I described the method we used to convert a legacy MySQL PHP database to a Rails conformant PostgreSQL hosted version. In this article I will tell a bit about how we converted the HTML of the application to Rails layout templates and partials.

It's a quickpost this time showing how to extract the rendered HTML from the page's output, writing out some of the business logic, and a mention of test driven development versus write test after developing methods.

0 comments voice your opinion now!
convert application rails part2 extract dom thml tdd business logic convert application rails part2 extract dom thml tdd business logic


Justin Silverton's Blog:
5 reasons why oscommerce is a nightmare
September 06, 2006 @ 06:44:07

On the High Performance PHP blog today, Justin Silverton has posted a few thoughts on why he thinks "oscommerce is a nightmare".

He quotes from the oscommerce.com site about what their goal for the software is and the methods they're working at to achieve those goals. Then comes his reasons for not wanting to use their software - five of them on differing subjects:

  • no separation of logic and presentation
  • difficult to integrate into an existing design
  • security
  • cannot have multiple sizes of image previews
  • admin navigation issues
He offers a bit of explaination for each of these, backing up his opinion with a few facts.

0 comments voice your opinion now!
oscommerce nightmare logic presentation integration security navigation oscommerce nightmare logic presentation integration security navigation


Scott Johnson's Blog:
Podcast PHP Theory 1
August 08, 2006 @ 12:22:35

Scott Johnson has created and posted another in his podcast series today, this time, he looks not at the development side of PHP - the actual code - but at the theory behind its development and best practices.

At the request of a listener to past podcasts, Scott created this one to share some of his experiences and findings along the path of his develoopment. Some of the items covered in the podcast include:

  • package and library management
  • naming conventions
  • the seperation of UI and business logic
  • code distribution
  • using test harnesses

You can download the MP3 of the podcast directly from here.

0 comments voice your opinion now!
theory development best practices package library naming logic theory development best practices package library naming logic


DevShed:
Working with Multiple Template Files to Separate Logic from Presentation (Part 3)
May 17, 2006 @ 06:07:46

Wrapping up their series on "Seperating logic from presentation", DevShed has posted this final article capping off the creation of a simple template parser in PHP5.

By returning to the subject of this last installment, I'll use the skeleton of the original "TemplateProcessor" class to develop an improved, production-level template processor, which, as you'll see in a few moments, will be capable of working with multiple template files, in addition to implementing a chunked caching system. In this way, the class will be able to use several templates that have distinct cache expiration times, aside from utilizing most of the template processing features that you learned before.

If you haven't read up on them yet, go back and check out part one and part two of the series to catch up. They'll give you the foundation to build from - not just the code but the concepts as well. This third part demonstrates chunked caching of your templates/pages as well as pulling in more than one template file at a time. Throw that all together with the functionality from before and you have an extensible, simple template parsing class they use in a bit more concrete example.

0 comments voice your opinion now!
php tutorial template processor seperate logic presentation php tutorial template processor seperate logic presentation


DevShed:
Developing an Extensible Template Processor in PHP 5 (Part 1)
May 02, 2006 @ 13:58:09

Building web aplications that split out the responsibilities correctly is becoming more and more important. Developers are creating more complex applications, and cluttering up the presentation with the logic of the code can only make things more of a nightmare down the road. Thankfully, there are articles like this one from DevShed to help you template your site correctly.

This is the first part of a three-part series that covers separating logic from presentation in PHP applications. In this article you will learn to develop a template system that is advanced enough to meet the requirements of a majority of applications.

It's possible to develop an intermediate template system that meets the requirements of a vast majority of applications, without the need to appeal to basic packages or having to deal with the numerous features of Smarty. It's precisely for this reason that this series will be focused on developing an extensible template processor in PHP 5.

You'll need a bit of experience with templating your site before you get started, as they begin with a basic structure of the template processor before anything. They demonstrate the code to create the "TemplateProcessor" class and defining the "processTemplate" method inside it. By the end of this first part in the series, they've created a very simple templating class that could be used as is for base-level projects. Stay tuned for more, though, if you're hungry for more features.

0 comments voice your opinion now!
php tutorial extensible seperation template system logic php tutorial extensible seperation template system logic


phpRiot.com:
Application logic versus template logic
May 02, 2006 @ 07:41:02

phpRiot.com has posted this new tutorial today that looks at a method to seperate out the application logic and the templates for your site. Their weapon of choice is the Smarty Template Engine.

What this is basically saying is that anything relating to the final output should be determined in the template, while any data handling or processing should be done in your PHP files and classes. There's a little more to it than though, which we'll soon see.

They introduce the reader to what the two sides are (application and template logic) and an example of the "bad way" to do things - application logic in your presentation layer. To counter this, they give examples of proper structure with examples like checking strings, alternating background colors, showing a counter, and the inclusion of another template.

A few other suggestions are made as to the good and the bad of templating your site, including two cases showing both sides.

0 comments voice your opinion now!
php application template logic seperation smarty engine php application template logic seperation smarty engine


Zend Developer Zone:
PHP Gotchas!
April 24, 2006 @ 12:49:58

The Zend Developer Zone has a new post for those out there struggling with the small stuff. You've got the language down and you're learning the syntax, but there's still a few things that elude your grasp. If this is you, check out their list of "PHP Gotchas" to see if your problem is on there.

Call them obscure, call them pointless, call them "newb mistakes." Whatever you call them, you've more than likely been tripped up at some point in your PHP coding journey by seemingly odd or illogical behaviors of the language. With PHP being a loosely-typed language, funny things are bound to happen.

PHP is an easy language to pick up for the casual coder--things should "just work." But not everyone comes into PHP development with a strong programming background, so here are some charming examples of ways PHP can trip you up if you aren't careful. Put on your thinking caps--here comes the science!

Included in their list of common problems for budding PHP developers are things like finding a "needle" in a string "haystack", working with constants, using and/or, and the __toString functionality in PHP5.

0 comments voice your opinion now!
php gotchas strings constants tostring logic math php gotchas strings constants tostring logic math



Community Events











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


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

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