News Feed
Jobs Feed
Sections




Recent Jobs

News Archive
feed this:

Juozas Kaziukenas' Blog:
Zend Framework tips and tricks
February 01, 2010 @ 09:46:30

Juozas Kaziukenas has a new post to his blog with some tips and tricks for working with the Zend Framework including working with globals, using the framework part of the framework and getting form values a bit more correctly.

Most of the outlined problems and solutions are focused on testability, maintainability and other good code practices. If you are not familiar with them, I recommend read about them ASAP as there is big chance that you are doing those things described in this post and don't even realize how wrong they are. Believe me, you will soon find yourself a way better developer.

He also advocates splitting out logic and putting it into a model to make future enhancements easier (and make for cleaner code), avoiding the use of exit/die in your scripts and quick mentions of the includePaths setting in the application.ini file as well as things like addJavascriptFile/addStylesheet/addOnload.

0 comments voice your opinion now!
zendframework tip trick



SitePoint PHP Blog:
A Note on Google's So-called Best Practices
June 26, 2009 @ 15:54:43

On the SitePoint PHP blog today Troels Knak-Nielsen has posted some of his own thoughts about the performance tips that Google recently published for PHP.

The project includes an article on "PHP performance tips", which is bordering on being ridiculous. There are of course lots of blog posts with similar nonsense around the web, but since this is being endorsed by Google, it's fair to assume that people might take it at face value. That's unfortunate, as almost none of it is true. The PHP Team responded back with this message, wherein they refute the unfounded nonsense.

He notes that these practices aren't the best road to optimization and, depending on when they might be used, could be harmful to the development of the application. He also recommends XDebug if you really want to get to know where your application is struggling.

0 comments voice your opinion now!
trick bad optimize bestpractices


Cal Evan's Blog:
Three Lists I Never Want to See Again
April 23, 2009 @ 08:43:56

You're all thinking it - Cal Evans finally just put it into words with his list of "lists [he] never wants to see again" in the PHP world.

Lists are all the rave these days for bloggers. The reason is obvious, they require very little thought or research to create. So, in keeping with the current trend, here is my list of three lists never want to see again.

His list of three are posts that contain:

  • 5,000 PHP classes and tutorials
  • 50 new PHP tricks you didn't know, didn't want to know, and will get you fired if you ever use them on the job
  • Top PHP Frameworks

Blog posts should be about real content, not just spitting back out something anyone could put together in ten minutes with a little copy and paste. As Cal puts it:

If you are using a new PHP class, CMS, framework, or have a new technique you want to share, share it. Write a blog post and tell me how or why it solved your problem; bonus points if you describe the problem that it solved. You are not adding to the conversation is you are just recapping what others have said.
0 comments voice your opinion now!
unoriginal framework trick tutorial class blog list


Smashing Magazine:
10 Useful RSS-Tricks and Hacks For WordPress
December 03, 2008 @ 10:28:41

Smashing Magazine has a few helpful RSS tips and tricks for WordPress users out there:

Let's take a look at 10 useful, yet rather unknown RSS-tricks for WordPress. Each section of the article presents a problem, suggests a solution and provides you with an explanation of the solution, so that you can not just solve some of your RSS-related problems but also understand what you are actually doing.

Here's their list:

  • Control When Your Posts are Available via RSS
  • Redirecting WordPress Feeds to FeedBurner Feeds
  • Insert Ads (or Anything Else) in Your RSS Feed
  • Format Your Images for Feed Readers
  • Provide Your Readers with a Feed for Each Post
  • Exclude Categories from Your RSS Feed
  • Display Any RSS Feed on Your WordPress Blog
  • Use Category-Specific RSS Feeds
  • List RSS Feeds by Category
  • Get Rid of RSS Feeds the Clean Way
0 comments voice your opinion now!
wordpress rss feed tip trick feedburner image category ad


David Otton's Blog:
Neat PHP Tricks How To Assign References to Globals
November 10, 2008 @ 09:32:18

David Otton has a new neat PHP trick posted today - assigning references to global values.

What follows isn't so much a PHP trick as a fix for something that really should work, but doesn't. Although the manual implies that the behaviour described below is specific to Zend Engine 1, all my tests were performed against Zend Engine 2.2, PHP 5.2.5.

His example compares making a new stdClass both with and without a reference on the it and var_dumps out the result. The method with the reference fails silently, however and isn't able to correctly assign it to the global. He recommends a work-around though - setting it directly to the $GLOBALS superglobal.

0 comments voice your opinion now!
reference global superglobal trick assign object example


Debuggable Blog:
Two CakePHP Tricks
August 25, 2008 @ 15:58:03

On the Debuggable blog Felix has posted two quick tips you can use in your CakePHP application - one related to debugging and the other about custom config files.

For tip #1

If you just put a debug() statement in, you will see hundreds of outputs and would not know which one belongs to the case you are interested in. My favorite solution to this problem is to use the Configure class as a toggle for showing the debug information.

For tip #2

This is a very simple one. To make your application configurable via a global config file, all you need to do is the following.

Both come complete with code examples.

0 comments voice your opinion now!
cakephp trick debug function custom configure file


David Otton's Blog:
Stupid PHP Tricks Illegal Variable Names
August 22, 2008 @ 13:47:52

David Otton has shared another of his "stupid PHP tricks" on his blog today. This one looks at illegal variable names that don't match the "can't start with a number" rule the manual points out.

A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*'

Technically, you can get around this in two different ways - variable varaibles and the more complex notation with curly braces. He points to the compact function for proof that they're set.

0 comments voice your opinion now!
variable trick illegal name compact curlybrace


David Otton's Blog:
Neat PHP tricks Casting Arrays to Objects
August 14, 2008 @ 13:38:10

David Otton has a handy little tip if you're looking for a cleaner way to deal with array data - casting it to an object.

Array notation is fine, but it can look a bit clunky when you're working with complex structures. [...] Casting the array to an object allows us to use object notation (->) and makes the code more readable.

He includes examples of the casting, showing the difference between the array and object notations including a method for creating an object based on a simple array that has basic properties built in. This sort of transformation can be useful if you want consistency through out the application - just passing objects with their properties rather than arrays.

0 comments voice your opinion now!
array object casting trick notation readable


Brian Moon's Blog:
Stupid PHP Tricks Normalizing SimpleXML Data
June 03, 2008 @ 09:34:22

Brian Moon has a "stupid PHP trick" posted to his blog today - normalizing SimpleXML data you've pulled in from just about any external source.

Anyhow, one annoying thing about SimpleXML has to do with caching. When using web services, we often cache the contents we get back. We were having a problem where we would get an error about a SimpleXML node not existing.

They were using memcache to store the information but came across problems when their code tried to use a (sometimes) empty tag. He gives two solutions - one using a recursive function that identifies the empty items and the other that encodes then decodes the object to and from JSON, keeping the values intact.

0 comments voice your opinion now!
trick stupid simplexml normalize json recursive empty tag


John Rockefeller's Blog:
PHP Tricks How To Handle Multiple Domains
May 27, 2008 @ 11:11:01

John Rockefeller has a tip he'd like to share with all of the other PHP developers out there - a little method he's come up with to host multiple domains off of the same code.

This is really handy for those of us who have the same code handling multiple sites or multiple sub-domains. A case in point: When I coded NetBoardz (my free forum hosting service now defunct), I had one codebase handling all 250 forums. How? Simple. When the code runs, it determines which site the user is loading and does different things (like using different databases) dynamically.

He shows the two key points to dividing things up - grabbing the domain and subdomain they were trying to access. This can be fed into a script that can switch things like layout or even functionality based on which site they've chosen.

0 comments voice your opinion now!
trick multiple domain same codebase subdomain hostname



Community Events









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


sqlserver developer wordpress release facebook codeigniter extension microsoft framework podcast opinion drupal job performance symfony apache conference zendframework windows feature

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