Filed Under (General) by Wenbert on 30-04-2008
Zend DevZone has a new article up.
What is a View Helper?
A View Helper is simply a class that follows particular naming conventions, When attached to a view object, you can call the helper as if it were a method of the view object itself. The View object retains helper instances, which means that they retain states between calls.
Common use cases for view helpers include:
* Accessing models
* Performing complex or repeatable display logic
* Manipulating and formatting model data
* Persisting data between view scripts
Filed Under (General) by Wenbert on 23-04-2008
This is useful to those who are trying to kick start a Zend Framework application.
Starting any new application is like walking into a shop and being dazzled by the displays. You want everything but finally realise you only have so much resources to spend. So you isolate the specifics you must have, and focus on those. That’s why I bought a Classic iPod, and not the much flashier iTouch (crap all storage anyway).
If we drill down the typical blog application we get a very short list of must-haves.
1. Authentication for Authors
2. Authorisation to create/edit/delete/read entries
3. Methods for adding new entries, and modifying them
4. Publishing entries as RSS and Atom
5. Permalinks unique for each entry (SEO friendly of course)
6. Commenting system
7. Spam detection for new comments
8. Perhaps, trackback detection
Click here for the entire post. I haven’t read the entire post yet - I just wanted to share it but I am assuming that it uses the new ZF1.5 stuff like Zend_Form and other cool features.
UPDATE: Here is the second part of the tutorial.
UPDATE2: Today (4-25-2008) Pádraic Brady just announced the link to his Subversion repository for the series of Zend Framework Blog Application Example. The SVN link is found here.
Filed Under (General) by Wenbert on 07-12-2007
A short but complete tutorial on how to write a Chat Application using PHP, AJAX and XML.
Developers talk a lot about community when the term Web 2.0 comes up. And whether you think it’s hype or not, the idea of engaging your customers or readers in an instantaneous conversation about the topics at hand or the products you’re selling is pretty compelling. But how do you get there? Can you put a chat box on the same page as your product listing so that your customers don’t have to install special software or even Adobe Flash Player? Sure! Turns out, you can do it all with free, off-the-shelf tools such as PHP, MySQL, dynamic HTML (DHTML), Ajax, and the Prototype.js library.
Without further ado, let’s jump right into the implementation.

Filed Under (General) by Wenbert on 22-10-2007
Here is how to get the difference between two dates in PHP.
…
public static function toTimestamp
($date){
$arrayDate=self::
toArray($date);
return mktime($arrayDate[‘hour’],
$arrayDate[‘minute’],
$arrayDate[’second’],
$arrayDate[‘month’],
$arrayDate[‘day’],
$arrayDate[‘year’]);
}
public static function dateDiff($date1,$date2,$unit=‘HOUR’){
$date1=self::toTimestamp($date1);
$date2=self::toTimestamp($date2);
$secs=$date1-$date2;
switch(strtoupper($unit)){
case ‘WEEK’:return $secs/60/60/24/7; break;
case ‘DAY’:return $secs/60/60/24; break;
case ‘HOUR’:return $secs/60/60; break;
case ‘MINUTE’:return $secs/60; break;
case ‘SECOND’:return $secs; break;
default:return $secs/60/60; break;
}
}
…
Usage:
DateFormat::dateDiff($current_tr->requisition_dateTo,$current_tr->requisition_dateFrom,"DAY"));
The static function example above is from an MVC Framework. But you can edit it the sample code to fit your needs.
This tutorial is documented here.