Skip to main content

Posts

Showing posts from November, 2007

ZF View Helper for switching between http and https

I created a view helper for Zend Framework for switching between a normal (http) and secure (https), as sugested by Naneau.

<?php
/**
* Helper class to switch between normal and secure protocol
*
*/
class Zend_View_Helper_HttpSwitch {

/**
* Property of our view instance
*/
protected $_view;

/**
* Get our view property
*/
public function setView(Zend_View_Interface $view)
{
$this->_view = $view;
}

/**
* Switches between http and https protocol
*
* @param array $route
* @param boolean $secure
* @return string
*/
public function httpSwitch(array $route, $secure = false)
{
// Hostname now set here, or in configuration file
// or set in the front controller.
// Zend_Controller_Front::getInstance()->getParam('hostname');
$hostname = "www.example.com";

// Check if we want to go secure or not
if ($secure === true) {
$protocol = "https"…

The new Zend.com website

Zend, the PHP company has a new website and a new logo. Although I'm not a graphical designer nor have I any graphical insight, my gut feeling tells me the new logo misses the flair other Zend sites (devzone.zend.com and framework.zend.com) have.

As for the new website, it's a huge improvement. A clear view on topics and a very easy navigation. Especially you can see how the technology works behind the scenes by clicking the right-top corner "Behind the Site". Don't expect much fancy stuff, it's just an explanation on how this site is managed by Zend products and the iBuildings CMS WDE. Both companies are working to port this CMS to PHP 5 and will be released in the nearby future.

Just see for yourself at zend.com.

Error handling in Zend Framework

For a couple of days I've been breaking my scull how to provide a good way to handle exceptions in a Zend Framework MVC application.

The ZF Manual has several ways of doing stuff, but none of them have a good example how to take care of these exceptions, and how to present a nice message dependend on the exception that was raised.

1. Using the ErrorHandler plugin
This is the easiest way of handling missing controllers, actions or modules. But it's usage is limited to these kind of exceptions. Other exceptions may break your application.

In your bootstrap file (index.php) you have your controller front setup:

<?php
/**
* File: index.php
*/

require_once 'Zend/Controller/Front.php';

/**
* Setup controller
*/
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory( '../application/controllers');
$controller->dispatch();

For using the ErrorHandler plugin, you need to have an error controller and an error view.

Here is an example of a simp…

Hunting for professional php developers

These days php is "hot" and everyone wants a piece of php. The only problem is that there aren't many "Certified Zend Php Developers" or ZCE's out there.

When I look at the Belgian Zend Yellow Pages, only 24 (today's count) certified php developers are out there, but by pure guesswork I estimate there's a need of at least 100 certified engineers.

Where can you find them ? And how can you persuade them into getting certified ? I'm not a recruiter, but I know lot's of people who are ready to hire them instantly.

I already got my certifications (php 4 and php 5) and it feels good to be part of an elite but small group of professional php developers. And let's be honest, who doesn't want to receive credits for their work ?!?

If you want to know more about this certification path, I can lay it out for you quite simple (just repeating Zend Certification php page):
Go to the Zend homesite and register yourself for an accountPurchase a Zend PHP …

Google's OpenSocial

Today everyone talks about OpenSocial, a recent service Google launches to interact with social networks and maintaining links with friends. The idea is that everyone can create their own applications (or widgets) that can link to whatever service that's out there using REST or core Google API's (e.g. with Orkut).

The idea behind this service is the popularity of Facebook's API that enables users to create custom applications on the Facebook core. And as a result, many other social sites have released their API's to their users for extra valued user experiences.

According to the OpenSocial FAQ's, this API is capable to communicate with already existing services using REST and JavaScript and can be used on .NET, Java and PHP environments.