Saturday, 3. November 2007, 19:58:11
source code, Zend Framework, PHP
Coming on again with the Smarty and Zend View related articles, let's this time take a look at how to get Zend's View Helpers running with Smarty.
Other examples for this that I have seen use a syntax like this: {helper helper=Url p='array(something)' p2=stuff}, which is kind of ugly and the array parsing is done with eval, and we know that
Eval is Evil.
Wouldn't a more elegant solution let you use helpers just like you use Smarty plugins? In the style of just typing the name of the helper and simple parameters? Let's see how to make that happen!
Read more...
Wednesday, 3. October 2007, 15:08:41
PHP, source code
Ever wanted to change where your PHP sends the output to a file instead of the browser?
I have, and it involved changing every echo and other printing statemenet to fwrite. But
there is a better solution to that...
Read more...
Friday, 10. August 2007, 15:04:57
design patterns, PHP, source code
In my
post about the problems in Zend Framework implementation of the MVC pattern I briefly mentioned the factory design pattern and that it could be used to create a view factory.
In this post I'll explain the concept of the factory a bit further and provide an example view factory implementation for you. We also brush the singleton pattern a bit.
Read more...
Tuesday, 31. July 2007, 22:21:01
web, source code, PHP
I've seen two articles describing how to integrate Smarty with Zend_View,
Integrating Smarty with the Zend Framework at Zend Developer Zone and
Zend Framework: Using Smarty as template engine at Dmytro Shteflyuk's blog. Both of these are
very outdated by now.
So here's take three on integrating Smarty with Zend_View, this time hopefully staying useful for a longer time since the Zend Framework has reached version 1 now.
In this post I will show you a way to integrate Smarty with Zend_View as a new subclass and how to use this class with the new ViewRenderer helper to automatically display templates.
Read more...
Friday, 22. June 2007, 06:05:31
C#, source code
Since I talk with many people who aren't finnish, I've sometimes had some problems with their timezones and such. You know, sometimes it's useful to know what time it is somewhere else.
You could of course just open up google and look up a page with the time for the place or change the windows timezone temporarily so the clock would show the correct time there...
But that's kind of annoying and time consuming, so I came up with a solution: Display a second configurable clock in the system tray!
Read more...
Tuesday, 22. May 2007, 17:19:27
javascript, programming, source code
I've sometimes faced the problem: How to remove nested elements from HTML source.
You have two options:
- If it's well formed HTML, you can use XML parsing functions.
- If not, you're left with traditional string-parsing approaches.
When you think about the second option, you probably think of something that keeps track of how many opening tags we have gone past and how many endings, ie. the depth.
That is, however, very complicated compared to the approach I'm going to show you.
Today it struck me: why not do it in
reverse?Read more...
Monday, 16. April 2007, 11:18:10
source code, web, PHP
As mentioned in the previous post,
How to improve your blog, in this post I'll demonstrate how to track the visitors of your site with PHP.
You should have some previous knowledge of PHP programming to understand the code and concepts.
Read more...
Friday, 13. April 2007, 17:39:44
C#, source code
Last year I wrote a command line application which you could use to play "songs" on the PC speaker. I called it "beepage".
Now I wrote a new version of the application: Winbeepage.
It's a pretty simple Windows application that lets you use the mouse to play different sounds from the PC speaker.
Read more...
Friday, 6. April 2007, 07:17:56
source code, C#, WinAPI
Anyone who owns a mobile phone knows how you type SMS messages on them. Unless it has a qwerty keyboard, which is quite rare, it's pretty cumbersome.
Still, for some odd reason I made an app written in C# that lets you do that on Windows with Numpad.
Read more...