Archive for the ‘Web Design’ Category

Anatomy of a WordPress Template: The Basics

Monday, March 10th, 2008

There are tons of free WordPress templates available, but at some point you’ll probably want to modify one or make your own. Even if you know HTML pretty well, this can be a daunting task at first.

WordPress templates have a decent amount of simple PHP mixed in, and you need to utilize a special file structure for the template to operate correctly. Before you dive into making a WordPress template, let’s look at the basic structure of a WordPress template compared to a normal website template.
(more…)

How to Time Delay Posts in WordPress

Saturday, March 8th, 2008

One reason I’ve heard people say that they prefer a full-blown CMS to WordPress is that WordPress doesn’t allow time delayed posting. I was about to figure out a way to mod WordPress to make this possible – until I realized that there is some decent built-in functionality for time delaying.

You can easily delay the release of your posts into the main indexes (front page, archives, “Recent Posts” list, etc). With a little bit of code, you can also restrict people from viewing the page before its appointed “Published” date.
(more…)

Use Javascript to Parse a Query String

Tuesday, March 4th, 2008

Most server-side scripting languages, like PHP, come with built-in functionality for reading query strings. Javascript doesn’t have any kind of standard counterpart, but that doesn’t mean you can’t use query strings in Javascript.

With some String functions, you can create your own function to parse a query string attached to the request url and store it in an associative array – just like PHP would for you.
(more…)

Add Custom Loops (Queries) to WordPress

Sunday, March 2nd, 2008

If you look at your WordPress template, the thing that drives your page is called “the loop.” That’s WordPress speak for looping through the result set (the posts) retrieved from the database.

If you wanted to make custom queries, you could certainly do that by diving straight into the database. However, WordPress comes with some built in functions for helping you query the database and display the results. By using these template tags, you can add custom loops in your template to display other post information.
(more…)

How to Enable Client-Side Caching of Resized Images

Saturday, March 1st, 2008

About a month ago, I wrote a tutorial on dynamically resizing images in PHP. Despite my best intentions, I never found the time to go back and rewrite the script to include server-side caching of the images created.

However, one reader asked if it was possible to enable a client-side cache of a dynamically resized image. It surely is, and it’s very simple.
(more…)

How to Randomize AdSense Ads with Javascript

Friday, February 29th, 2008

I came across this problem on the forums today. How can you randomize which Ad Sense ad to show using Javascript?

The solution, it turns out, is very simple.
(more…)

Widget Bucks CPM Ads a Disappointing Waste of Time

Wednesday, February 27th, 2008

Widget Bucks is a relatively new ad network. At first glance, they appear to be a great alternative to Ad Sense – attractive ads, competitive eCPM rates, and CPM payment for non-US visitors.

After trying them out though, I found one aspect of their network – the CPM ads for foreign visitors – to be entirely disappointing.
(more…)

How to Spoof a Form, or Why Your Form Isn’t Safe

Monday, February 25th, 2008

Forms can create all kinds of security holes in PHP applications. The biggest reason for this is that you can never be sure just what kind of input you’ll be getting.

There are some steps you can take later on to protect your applications from this unknown input. But first, let’s take a look at why you can never trust a user’s input and just how easy it is for someone to spoof a form.
(more…)

RSS Feed: Building an RSS Data Feed in PHP with SimpleXML

Thursday, February 21st, 2008

RSS feeds are a must-have for modern websites. It’s easy enough to make an RSS feed of recent articles in PHP. But did you know an RSS feed can simply be information – not links to articles?

This article will look at how to build a basic feed of data – for our purposes, we’ll consider random quotes. It will also illustrate how to use SimpleXML to build the feed for us.
(more…)

Great Resources: Learning JS, AJAX, and DOM

Tuesday, February 19th, 2008

Over the weekend, I decided it was finally time to learn how to use JS and AJAX. I’d deliberately avoided using JS for anything I could accomplish in PHP – but I admit that I was getting a bit intrigued by the AJAX hooplah.

I found some very useful resources for dealing with JS, AJAX, and DOM, so I thought I’d share them for any other eager learners.
(more…)