Putting Code Together Since 1987

Archive for December, 2007|Monthly archive page

WordPress and the iPhone

In Web Development, Wordpress on December 27, 2007 at 5:00 pm

Two hot topics, in one post. WordPress is the hot blogging tool right now, and the iPhone is one of the hot mobile phones too.

So it’s a shame that they don’t work that well together. In this article I go through the following:

  • Posting to WordPress.com from the iPhone
  • Posting to a self hosted version of WordPress using the Mobile Admin plugin
  • Posting to WordPress from the iPhone and including images with the post

The latter is a particularly vexing problem, and one to which I can’t solve for WordPress.com. However, it’s relatively easy for self-hosting, or profesionally managed WordPress site owners to get images into their website, from their iPhone. Or for that matter, many other platforms. But this post in particular is all about getting on with WordPress when using an iPhone. Mainly because my shockingly generous girlfriend got me one for Xmas, I’m poorly, and I don’t feel like doing any ‘proper’ work today.

So let’s begin…

WordPress.com and the iPhone

WordPress and WordPress.com both use, by default, the TinyMCE editor. And it’s not a bad little editor either. A little buggy at times, but it’s feature rich and simple to use. What it won’t do, at least as supplied by WordPress, is work with the iPhone. You’ll have to tap on the Code tab above the editor and just enter plain text. You can then publish just fine.

If you’re only blogging from your phone you can turn off the visual rich editor in the WordPress Users | Your Profile tab in order to make this a simple one touch job. It may also save you the occassional Safari crashes that I experienced with the MCE editor running, even though I didn’t use it.

But… you probably aren’t limiting yourself to phone only blogging, and you probably like the editor. It lets you do nice things. But there’s also another problem… go down to the Upload part and you’ll notice that you can tap as much as you like on a “Choose File” button, but nothing will happen. So you can’t add images from your iPhone to your WordPress blog.

WordPress, the iPhone, and the Mobile Admin Plugin

If you’re a regular mobile blogger and you have your own, self-hosted or managed WordPress installation, then you have the option of plugins. And one of the handiest for WordPress is the Mobile Admin Plugin. You’ll need to follow the usual plugin steps – checking for compatibility, installation, and activation. But once you’ve followed the instructions it really does make using the iPhone (and for that matter, many other phones) on WordPress sites a cinch.

What’s great is that if you access the site admin using a normal PC, you still get the normal control panel.

Below are a couple of screenshots showing it in action:

WordPress Mobile Admin Screenshot 1

WordPress Mobile Admin Screenshot 2

Lovely isn’t it? And if you’re wondering why I’m not posting any of my own screenshots, it’s because I’ve not hacked my own iPhone in order to get the SSH access I’d need to take screenshots.

There’s only one downside, and I feel it’s a big one, to the whole Mobile Admin experience. It’s important to me as I’m a visual type and I like illustrations wherever possible – especially if I’m travelling and feel like showing some shots of where I’ve been. I’m also particularly keen to make it work as I had photoblogging to my WordPress site (Dave’s Geeky Play Area Blog) working just fine from a Nokia N95. Ok, that took some hacking too, but I’ve had photos… I want to continue with photos!

Posting Images to a WordPress Blog With Your iPhone

If you host your WordPress site yourself, you can do a lot… and get images from your iPhone directly to your site!

Now, the iPhone won’t tolerate MCE yet, and it won’t use the upload wizard in standard WordPress. So what’s to do? ftp tools don’t exist yet, so you can simply ftp your shots onto your site… which suggests that you’re stuck.

Well fear not. I’ve been casting around all afternoon and found the following works best. Basically, with WordPress you can set it up so that you can post to it by e-mail. This does require setting up either a cron job (something many hosting providers won’t do or allow) or it means hacking around so that the job fires off every now and then. Thing is, the standard WordPress wp-mail.php program doesn’t actually work all that well with images. In fact, it doesn’t work at all with anything other than text. So you’ll need something a little more…heavyweight.

But with WordPress there’s always a way. The plugin you need is called Postie, and this is what you have to do:

  1. Install the Postie plugin
  2. Read the instructions! Maybe do that before installing it?
  3. Go to the Postie config page as instructed (it’ll show the readme first – just refresh), and set your image resize to something appropriate to your theme
  4. Set up an e-mail account on your host that’s especially set up for receiving posts to your blog. Keep it a secret and make the password tricky too. Configure this information in Postie, bearing in mind the default port for e-mail is 110 (not defaulted into the form by the Postie plugin).
  5. And then the easiest way to get an image to your site is from the iPhone image gallery press the little swoosh icon in the bottom left of the image viewer.
  6. Tap Email Photo.
  7. In the New Message box you should enter the To: e-mail address that you set up in step 4. You can also enter some text in the box. Press Send.
  8. Now, the content won’t appear yet in your blog, but it’ll be waiting… all you need is to send a browser to http://www.yourdomain.com/wp-content/plugins/postie/get_mail.php or, if your WordPress is installed in its own directory: http://www.yourdomain.com/WordPressDirectory/wp-content/plugins/postie/get_mail.php
  9. You can set up a cron job if you’re allowed, but it’s not my favourite way anyhow. I like to just have a favourite in my browser for mail posting which I click on whenever I need to update the site.

And that’s it! Ok, it took a bit to get there, and it’s not integral to WordPress so you can’t guarantee support on version changes, but… it’s one way forward, I’ve tested it, and it works well on WP 2.3.1. If you spot any mistakes, please comment!

If this post is popular I may well try and add some screenshots, photos and sample posts. I also plan to do a similar post soon on the Nokia N95 and WordPress.

Wanna Be A Great Developer?

In Web Development on December 20, 2007 at 12:53 pm

It really scares me how few good programmers actually exist in this world. I only bump into them professionally and even then, not as often as I’d like. If, for example, I meet someone at a party and he says he codes I’ll put a bet on he or she lacking a huge range of skills.

The sad thing is, I’m not perfect either. I understand stacks, and linked lists, and bitwise operations, and all the different logical operations. I find loosely typed languages annoying and scary – I hate orphaned variables, do-nothing functions, and the spaghetti that seems to make up so many modern systems. But I’m easily confused by OOP, understanding only the basics and not really having a full grasp of things like polymorphism. My excuse being that I’m a database and procedural languages expert instead. But the modern world seems to demand skills in a range of languages, and the slightly obscure stuff of my past (PL/I, Adabas Natural, PeopleCode, SQR and Application Engine leap to mind) aren’t relevant in this WEB2.0 world.

Now, I’m getting to the point of this post… I found a great post by an Indian blogger titled How To Become a Good Programmer and it’s an excellent summary of the knowledge required to be a quality developer. Some isn’t strictly a must-have – I’ve known astonishing developers who wouldn’t make half his list… but I think as a broad guide it’s spot on.

Site Features Can Go Hilariously Wrong

In Web Development on December 19, 2007 at 12:45 pm

I’m going to shamelessly nick a few images here from a site we designed, manage and host (Sniff Petrol) , but which is run and written by someone else. In finding this he showed a great example of why you should think about any new features you add to a website.

The idea seemed good enough – Car Magazine added a search terms Cloud, rather like a tag cloud, to their website to show what people were searching for. Problem is though, with any user generated content you have to watch carefully for abuse.

First off, they seeded the search cloud with a few terms that they obviously felt the aspirational and tasteful visitors would like – such as Aston Martin Vanquish, BMW M1, Ferrari and so on:

Car Magazine 1

So far so good.

But Sao Penza? Who would look for such an obscure car? Quickly, somebody realised that there weren’t many values for the search cloud to pick up on and that it could easily be gamed… Either that or readers of Car Magazine have a hankering for Bum Gravy and Cillit Bang:

Car Magazine

Perhaps it was just a passing glitch and soon everything would return to normal:

Car Magazine 2

Ah, no… and guess what? The took it down soon after.

I think in any sort of web development and design it’s important to try and think “how could this be abused” and then either put in place ways to prevent it, or be ready for it. Some sites have disappeared completely after being spammed to death, with the owners unable to fix it, and lacking the funds to bring in suitable expertise. It’s a hard world, the Web, and coding safely for it demands a rather cynical approach at times.

All stuff taken from this Sniff Petrol article, and written in a much funnier way than I can ever manage…

Attention WordPress Hackers! At Last, a GPL Theme Worth Playing With…

In Wordpress on December 18, 2007 at 12:57 pm

We finally built GPL theme for hosted versions of WordPress! And very pretty it is too…

Anvil Theme for WordPress

We’ve been writing custom themes for clients for quite some time now, and felt it was time to give a little something back to the WordPress community.

So we did a fully GPL theme, complete with a Fireworks png, all sliced up and ready to be re-exported in such a way that you can completely change the site’s design without ever touching a line of code. You have to work within the limitations of the graphical elements, but there’s no doubt there’s a lot you can do.

You’ll see variants of the theme in use around the place – on the satirical motoring site Sniff Petrol on Dave Coveney’s site, and in a few other places soon we hope. We have high hopes for the underlying platform of this theme – it brings with it a navigation widget to give you fine control of an elegantly styled sidebar, an easy to customise contact form page template, and much much more. It’s a theme for people who like to expand what they can do with WordPress. It’s also, of course, xhtml 1.0 transition, works on every browser we tested on, and the work of a dedicated team of professionals.

Anvil Theme Official Demo and Download Page

Well done WordPress! Two million and counting…

In Wordpress on December 17, 2007 at 10:48 pm

So we’re hoping to be one of the first to congratulate WordPress on hitting the two million blogs mark.

What can we say? Well done!

WordPress hits two million!

To us it’s big news – we’ve made a strategic decision to be increasingly involved in WordPress.  With the up and coming premium themes marketplace we’re hoping to be involved with, coupled with the increasing use of WordPress as a CMS, we believe the flexibility and power of this system makes it the one to be involved with – whether for blogging or for building general sites.

So here’s to the next two million.  Seems like WordPress is doubling every six months or so.  Which would mark out eight million blogs by Xmas 2008.  Who’s laying bets?