Building a URL Shortener

27 Apr 2009

With all the talk of URL shortening services, I decided to add a quick service into Snook.ca, which is run on CakePHP, to redirect a short URL to a post. Because my static content already has short URLs and all I have are posts, creating a short URL handler for it was very easy. To give you some context, I route my posts through a specific structure: /archives/:category /archives/:catego...

Read it all »

PHP header can only be called once

11 Apr 2008

I hate spending too much time just trying to solve one little problem. This was seriously one of those times. To give some background on what I was trying to do, I needed to have a user log into one system and have it automatically authenticate against another site on the same server. Your usual "single sign-on" functionality. The problem was, I didn't want to duplicate a lot of cod...

Read it all »

Zend Framework: First Impressions

10 Jul 2007

Last week, the first production release of the Zend Framework was released. I've taken some time to read through the documentation to understand what each of the components do. And you know what? I think I like it. What is it? A powerful high-quality open-source framework focused on developing modern Web Applications and Web Services That's how Zend describes the framework. What's interes...

Read it all »

CodeIgniter vs. CakePHP

18 Mar 2007

I almost fear putting this kind of post together as it's bound to pull the fanatics (in the negative sense of the word) out of the woodworks. Right off the bat, let me just say that I've tried to be as fair and honest in this assessment and I've tried to keep it just to the facts while interjecting what my preferences are. I'm pitting these two frameworks against each other but there really isn't...

Read it all »

Symfony 1.0 Released

20 Feb 2007

Symfony is an open-source PHP web framework, much in the same vein as CakePHP (which I use), and it hit 1.0 yesterday. I hopped in to take a closer look at things by poring over the documentation and comparing it to what I know about CakePHP. Very similar yet very different Symfony and CakePHP take very similar paths when it comes to how they approach things. It's the typical MVC approach wit...

Read it all »

The Modulo Operator for Alternating Rows

01 Sep 2005

One common design feature is to have different visual treatments for alternating rows. As you iterate through a collection, you can use the modulo operator to determine if you're in an even or odd row. In most languages, the modulo operator is the percent sign: %. Here's a quick example in PHP: for($i=0;$i...

Read it all »

Show FeedBurner Circulation using PHP

29 Aug 2005

As it turns out, I'm not a fan of the Feedburner chicklet (as they call it) that gives you your total subscriber list. In fact, what if you wanted something a little more unique? Borrowing heavily from this code example, I put together this quick script that pulls in your total circulation: <? // define parameters $feedid = 'snookca'; $cache_time = '43200'; // in seconds (43200 = 24 hr...

Read it all »

How I Added a Weighting to My Tags

25 Jul 2005

In an extension to How I Added Tagging Using PHP and MySQL, I'll cover how I added a weighted tag list to FONTSMACK. Again, the process is fairly straightforward except with a little math this time. There are essentially two steps to this process. Step 1: Determine the number of steps while($ftypes = mysql_fetch_array($rs)) { $types = array_merge($types, explode(" ", trim($ftypes[0]) )); } $...

Read it all »

How I Added Tagging Using PHP and MySQL

11 Jul 2005

On FONTSMACK, I just enabled the ability to view fonts by tag. The tags, I suppose, are more like keywords as there is currently no user intervention to tag fonts with their own keywords. In any case, my implementation is fairly straightforward and I hope this will help others looking at implementing something similar. The Database The database for FONTSMACK is straightforward. All fonts are stor...

Read it all »