Hello World

Practical programming... and stuff...

Archive: July 2007

Smarty + Zend_View, take three

, ,

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...

Common crossbrowser CSS issues

,

I've recently been working on a few websites and there are some common problems that I've encountered in Internet Explorer and Firefox while developing these. Here's a small list of things that may cause problems and what to do to solve them.

Read more...

Changes ahoy

I will be moving this blog to my new domain, CodeUtopia.net.


Moving? I don't think I'm going to grab all the posts and repost them there, maybe a few useful ones... but I will not post new stuff here anymore after I've set up something I can use for blogging at the new address... which may actually take a while because I might want to code my own blogging software =)

Read more...

Opera at the daily wtf

Those of you who read The Daily WTF/Worse Than Failure probably have noticed this by now... but Opera Mini beta 4 simulator made it to the latest Error'd post.

In case you haven't read the posts at TDWTF yet, I suggest you go and start from the oldest ones. They are often very funny and it honestly makes you think how/why would anyone do that?... a few articles have also reminded me of my very first PHP apps. Ugh. lol

Ruby on Rails vs. PHP

,

I saw three intresting videos on YouTube today:

Ruby on Rails vs. PHP
Ruby on Rails vs. PHP - Organization
Ruby on Rails vs. PHP - Changing database

They are Ruby on Rails commercials in a similar style as "PC vs. Mac" videos that you've probably seen.

Read more...

MyOpera status

I decided to throw together a widget for updating your status here on MyOpera. Or is it My Opera with a space? Well, in any case...

It's a nice little feature... but quite useless to be honest... Fun, but useless. bigsmile


I had to do some research to be able to make the widget work: It wasn't immediately obvious from looking at the HTML code for this page how it should do the XMLHttpRequest calls, but luckily the Opera folks hadn't obfuscated their JavaScript code that does the AJAX when you change your status, so I was able to get help from there.

Additionally, I realized I needed to add log in to the widget; Despite being logged in in the browser, the widget wouldn't be able to update the status. For this I again took liberties to get some help from Opera's people's code, this time the My Opera widget.


In the end the widget is very simple. It just does some AJAX calls and with Prototype making them work was a breeze. Have I mentioned how much I like Prototype? No? Oh, well in that case: Prototype is the best JavaScript AJAX/DOM library. Period.



As an end note, I know some of my old widgets are in need of updates... I'm sorry, I don't have enough time to go over them. However, if you like them and want to fix it on your own, I'm happy to answer questions related to the source code etc. and if you send me an updated version, I'll go over it and if it's okay I will upload it as a new version with credits to you. Note that this applies only to bug fixes, not completely new feature additions.

Blog tag: 5 things I'd like to see in Opera

,

The second time I've been tagged, and this time it's actually something I can be bothered to reply on!

Not in any particular order of importance.

1. No more crashing when disk full
2. URL bar search for bookmarks
3. In the recent versions I've been having weird slow downs, so no more those
4. Sessions that support multiple windows. Oh how many times I've had two windows open and closed them in the wrong order, losing my tabs. I hate it.
5. Better developer tools

I'm tagging Ramunas, rbb, drlaunch, albertrosa and aleksanteri.

The actual price of code

I've recently been trying out ScriptLance. It's basically a site for webmasters to post projects to which freelance coders can bid.

I've noticed an intresting phenomena while bidding on the projects...

Read more...

Collecting email addresses from websites

,

Recently I was asked to create a script to gather all email addresses from a certain website.

The script was to traverse all the pages on the site, find email addresses and save them to a file.


Now, you might think that this is a very complex task, as you would need to write a lot of code that would look for links on the pages to find more pages and so on, but with smart use of some common Linux utilities it's a very simple job.

Read more...

The simplest PHP template engine

,

If you have done more PHP programming you've probably used a template engine or two. I personally prefer Smarty as my template engine of choice for most projects.

If you don't know what a template engine is, I'll give a short explanation: Template engine is something that can be used to help separate HTML from PHP - You do all your "business logic" in a PHP file, for example you fetch some things from a database. A template on the other hand is meant to display that data. This is usually achieved by assigning the data to template variables in PHP and then displaying the template file.

But most template engines need setting up and their own code base etc., so for small projects they might add unnecessary complexity and things like that. However, PHP on its own can be a simple template engine! In this post I'll show you how.

Read more...