Web Development: Tables

Published on Sep 17, 2009   //  Development

Web Development

Organizing data to be presented on the web may seem like a daunting task, but it isn’t. We can use tables to easily organize our data into columns and rows. Today, we’ll be going over the basics of how to use tables to organize data.

Tables are broken up into rows and columns. You must begin with a row, which will then contain one or more columns. In theory, you may have an unlimited number of rows and columns. Practically, there is a limit to the number of columns you can cleaning present within limited screen resolutions.

Today, we’ll be looking at three HTML tags for creating tables: table, tr and td. table obviously begins the table, wrapping around the other tags. tr begins a row and wraps around the column tag, td. Let’s have a look at an example of a simple table:

[html]<table cellspacing="3" cellpadding="3">
<tr>
<td>
Row 1, Column 1
</td>
<td>
Row 1, Column 2
</td>
</tr>
<tr>
<td>
Row 2, Column 1
</td>
<td>
Row 2, Column 2
</td>
</tr>
</table>[/html]

You’ll notice how we used cellspacing and cellpadding attributes in our table tag. These allow us to adjust the amount of spacing between each “cell”, and the amount of padding in each “cell”. Visually, our table will look like this:

Row 1, Column 1 Row 1, Column 2
Row 2, Column 1 Row 2, Column 2

While our example isn’t much to look at, you can see the potential here for easy data presentation. Next week we’ll go over some more advanced stuff on tables.

WordPress Development: Automatic Feed Links

Published on Sep 14, 2009   //  Development
Off

WordPress Development

In the most recent post of our Web Development series, we discussed specifying feeds for browsers to discover. Today, we’ll be going over how to easily do this with WordPress themes, using some built-in functionality.

In some portions of WordPress, there may be multiple feeds that apply to one page. The two main feeds are the posts feed and the comments feed. When you’re visiting a post or page with comments enabled, a feed of comments on that post is available. There are also feeds available for categories and tags.

As you can imagine, ensuring you are specifying these feeds to the browser when appropriate can get complicated. Beginning in WordPress 2.8, a simply way to achieve this has been available. The function that allows us to do this is automatic_feed_links(). This function will output the appropriate feed specifications to the wp_head of your theme, taking all the guess work out of doing this manually.

To implement this, you must first ensure that you have a wp_head() call in the head of your theme. Otherwise, this method will not work. Then, all you have to do is add a call to automatic_feed_links() in your theme’s functions.php file (don’t forget the opening PHP tag if this file is blank current). Then viola, you will have feed links placed in your theme automatically.

Everything PHP: MySQL Primary Keys

Published on Sep 12, 2009   //  Development

Everything PHP

When performing a select query on a database, you’ll likely be specifying a where clause to narrow your results. Searching through a database can be “expensive” (CPU and time intensive). Today we’ll be looking at a case where you can make this search less-expensive.

First of all, let’s talk about a use case for this article. If you want to retrieve a single row from the database, based off a field that will always contain unique data. For example, if you were retrieving a blog post from the database, you might search for it by a unique id.

If you have a use similar to the one described above, you may be able to speed up your select query. By adding a primary key to the described unique field, MySQL will keep an index of these fields for quick searching. This will allow you to perform quick select queries using the primary key field for the where clause.

As you may imagine, this has many use cases. From selecting a blog post by its “url slug”, selecting a product by its id and infinitely so-on.

Web Development: Specifying Feeds

Published on Sep 10, 2009   //  Development
Off

Web Development

A feed is a format to allow the retrieval of recent content. Feeds are commonly used with blogs, news outlets, etc. If you have ever used a service like Google Reader, than you will know what a feed is. Some people may be more familiar with “RSS Feed”, which is simply one of the types of formats for a feed.

All modern browsers now have an interface for displaying available feeds on the current page to the user. However, you need to add specific markup to your page for browsers to display your available feeds to the user. This is what we will be covering today.

To allow browsers to pick up on our feeds, we’ll need to use the link tag with some special attributes. We’ll need to specify that the feed is alternative content, what type of feed it is (RSS, Atom, etc), the title of the feed and, finally, the URL of the feed. For example, if you have an RSS feed you want to be discovered by browsers, you would add something like this to the head of your document.

[html]<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://example.com/rss/" />[/html]

While for an Atom feed, you would need to change the type attribute accordingly:

[html]<link rel="alternate" type="application/atom+xml" title="Atom Feed" href="http://example.com/atom/" />[/html]

You may specify as many feeds as you need to. For UX purposes, you should use a clear and concise title for each feed you specify.

Moving Beyond SSH: Staying Current

Published on Sep 5, 2009   //  Development

Moving Beyond SSH

Everyday, thousands of servers will be hacked into and compromised. A large contributing cause to this is running outdated versions of software that can contain security vulnerabilities. Because of this, it is important to stay on top of your server’s software updates (just like you should with your personal computer).

However, keeping track of when software is updated can be a nuisance. Updates could be distributed at any time, on any day. You can’t possibly check for new software every single day, and even just checking weekly is less-than-ideal (you may forget to check one week, and miss a critical update).

Luckily, most server software developers offer some sort of announcement mailing list or feed. By subscribing to these, you’ll be able to stay informed on software updates with no ongoing effort at all (other than checking your email or feed reader, but you likely do that regardless). For convenience, I’ve listed some for more popular server software below:

Apache Release Announcements
PHP Release Announcements
Subversion Announcements
CentOS Announcements

Subscribe, and be worry-free… in regards to staying informed with your server’s updates.

WordPress Development: Plugin Suggestions

Published on Sep 5, 2009   //  Development

WordPress Development

In the past eight months, we have covered quite a bit on WordPress development. Now, I’d like to take a new spin on the topic, and actually create a plugin. Over a few articles, we’ll go over step-by-step through the programming process. This should allow readers to get a more in-depth look at the process of building a plugin, from start to finish.

Before we can start this, we need some ideas on a plugin to build. Preferably this plugin would incorporate anything we’ve learned (widgets, etc), without being overly complex. If you have any suggestions, please drop them in the comments.

Page 3 of 4212345...102030...Last »