TagCloud in PHP
Tag Clouds are used in many websites, but most of the time in bad ways. Even though I am not the largest fan of them, I will teach you how to generate one using PHP in three different methods. I mostly am doing this because I needed a tag cloud to quickly show me the most used search terms to reach my websites, and I figured tag clouds do this fairly well.
Create Vertical and Horizontal Gradients in PHP
PHP GD Image Functions are a great way to customize images, add copyright information, add text, resize and a lot of other functions. But what I’ve noticed a lot is people using flat colors for the images they create. Now, I know “Flat Design” is in, but some gradient is nice. I figured most people don’t want to try to setup gradients or think it is too difficult.
I’m going to share some code I wrote recently for a website on how to create gradients in PHP using the normal GD Image functions. The function uses HTML Hex Codes for the color values and then converts them over to an array that has the RGB values. It’s a lot easier to just pass a 6 character string instead of 2 arrays as parameters for a function.
Favicons Inside of WordPress
Adding a Favorite Icon / Bookmark Icon / Favicon / Website Icon to wordpress is a lot easier than you may think. But it still does require some work. The first way won’t take more than a few seconds after you have the icon you wish to use. But it is highly suggested you use both methods since it will work better across different browsers and search spiders.
Method 1 - Favicon.ico in Root Directory
This method is the most common method, and a lot of websites that show favicons next to URL’s (YouTube and Google Plus for example) will use favicon method. Instead of having to parse your website’s HTML for the favicon, they just check a single URL of [website]/favicon.ico.
Twitter API 1.1 Get Tweets
Twitter for a while have been pushing users to move to version 1.1 of their API. And now they are forcing you to since 1.0 has been taken down. For a lot of users this doesn’t matter since they use WordPress plugins or others of the sort. I liked using jsonp to pull tweets and not worry about it.
I put a little bit of time creating a simple PHP Twitter Library to pull your most recent tweet or tweets. This only works for Public Users and uses the Application Authorization method described below.
HTML5 Game Development Basics
Are HTML5 games the future? Who knows, but I do know they are popular, easy to make, and overall fun to make. Below I am going to walk you through creating your first game in HTML5 and JavaScript. This walk-through will mostly be showing you how to do specific things in HTML5 to build games, not a copy and paste to make your own game. You will have to use what you learn from this and implement it yourself.