PHP10 posts

Image for "Relative paths in PHP INI"
PHP

Relative paths in PHP INI

Improve the portability of your code from server-to-server with environment variables in your PHP INI.

Image for "Multiple forms on the same page in Zend Framework"
Zend Framework 1

Multiple forms on the same page in Zend Framework

Processing two forms on the same page is not the simplest task in the Zend Framework. After a few attempts, I think I found an elegant solution.

Image for "Preserve encoded slashes in URL"
IIS

Preserve encoded slashes in URL

Configure your IIS URL rewrite tool to preserve encoded characters in the original URL.

Image for "MVC Form Layer"
MVC

MVC Form Layer

Forms are a tricky part of any Model-View-Controller (MVC) application. They incorporate validation, presentation, and security logic that spans all tiers of the application. Separating these concerns is difficult but important. I'll walk through how I use Zend_Form in Zend Framework 1, but the same principles should apply to any MVC application.

Image for "Using sprintf with multiple iterations"
PHP

Using sprintf with multiple iterations

PHP's built-in sprintf() function is great for formatting complicated output and improving code readability. I recently had the need to output a string multiple times with some changes each time.

Image for "Zend_Form_Decorator_Fieldset for individual elements"
Zend Framework 1

Zend_Form_Decorator_Fieldset for individual elements

Here's a custom decorator to render your Zend_Form_Element with a <fieldset>.

Image for "Zend_Validate_Callback Success on False"
Zend Framework 1

Zend_Validate_Callback Success on False

What if you need to validate input using a callback function that will return False when the input is valid? Here's a custom validator to do the job.

Image for "Zend_Validate_Callback with no context"
Zend Framework 1

Zend_Validate_Callback with no context

This class is super simple, so we'll begin with the code.

Image for "Hosting PHP on IIS7"
PHP

Hosting PHP on IIS7

Running PHP sites on Internet Information Services (IIS) is easy! And with a few extra steps, you can achieve a versatile and extensible setup to avoid management headaches down the line. Follow this guide to add PHP functionality to your IIS server and avoid common mistakes.