A Simple ViewHelper For FLOW3
For some time now I have wanted to use FLOW3 for work-projects. However it was not until it recently got out of the alpha/beta cycle that we decided to use it for a critical project.
Mostly for fun, I just now finished a simple viewhelper which is a very simple version of the rails method distance_of_time_in_words. My viewhelper is much simpler than this, and were created in less than twenty minutes. I might however implement the Rails conventions since I quite like them.
As always I have created a gist where you can find the code for it:
The usage is as simple as all other FLOW3 view helpers. First include the namespace, and then call the viewhelper by name. Call it with either a DateTime object, or a string which it's constructor accepts, otherwise an exception will be thrown.
{namespace c=ClausWitt\ViewHelpers}
<c:ago date="2011-11-15T18:15:44+01:00"></c:ago>
At the time of writing, the above outputtet: "3 hours from now".
