Horrell.ca

Introducing the Mobile version!

Posted on January 13, 2007, modified on August 28, 2011 | No Comments

A few months ago I pur­chased horrel.mobi with the vague incli­na­tion of actu­ally doing some­thing with it like, you know, a mobile ver­sion of this site. I strug­gled a bit with how to do this since I was hav­ing a hard time try­ing to fig­ure out how to serve a dif­fer­ent page to the new domain from Textpat­tern. Then, along came the ied_if_domain plu­gin (orig­i­nal forum post) and my prob­lem was solved. Inter­est­ingly, I also fig­ured out another handy solu­tion using Sim­plePie, but I’ll get to both of those solu­tions later.

Of course the day I finally get­ting around to imple­ment­ing this is the day Apple intro­duces a new phone a real browser in it1. Damn! Well, this is def­i­nitely going to change things for the bet­ter and in time I hope more com­pa­nies start pack­ag­ing a decent browser with their phones. And that means, of course, that a hav­ing a sep­a­rate “mobile only” ver­sion won’t be nec­es­sary. Or at least, won’t be as nec­es­sary. Admit­tedly, I’ve never been a huge pro­po­nent of a mobile only web, as vaguely alluded to before. I bought the mobi domain any­way because, well, I’m a bit of a geek and also to grab it before any­one else got their filthy hands on it.

That being said, I thought I’d share how I pulled this off since the mobile mar­ket isn’t going to change over night and there are prob­a­bly some other good uses for either approach.

The ied_if_domain plu­gin approach

This is what I cur­rently use for my Textpat­tern dri­ven site. It assumes you know your way around Textpat­tern and know how to install plu­g­ins, mod­ify pages and forms, fid­dle with Textpat­tern tags, and the like2.

  1. First, I cre­ated my horrell.mobi domain as an alias to my main one, horrell.ca (here’s some instruc­tions on how to do this at TextDrive, writ­ten by yours truly).
  2. Next, I installed and acti­vated the plu­gin. You can find the plu­gin here and here
  3. And Finally, I mod­i­fied a few of my exist­ing page tem­plates, specif­i­cally the default one and a cus­tom one I cre­ated for the Con­tact page. At the top, I used a <txp:ied_if_domain domain="horrell.mobi"> con­di­tional to gen­er­ate my mobile only pages and then my reg­u­lar page fol­lows after the <txp:else /> state­ment. There’s an exam­ple of how to do this in the plu­gin help if this doesn’t make any sense.

So, what the plu­gin does is check to see if my page is being accessed by the mobi domain and, if so, pro­duces a slim­mer mod­i­fied ver­sion of my main and con­tact pages. Pretty neat eh?

Now while work­ing on this I had another idea. I remem­ber think­ing “How can I get con­tent out of Textpat­tern into another site?” You see, I was think­ing of hav­ing horrell.mobi as a com­pletely sep­a­rate domain, not an alias, and I was toy­ing with the idea of using PHP to grab con­tent directly from the Textpat­tern data­base. I wanted it sep­a­rate to keep my Textpat­tern tem­plates sim­ple but, admit­tedly, mess­ing around with PHP and MySQL didn’t seem like the best approach. Then it hit me: syn­di­ca­tion! All I had to do was grab con­tent from my site feed and use that and thus was borne the Sim­plePie approach.

The Sim­plePie approach

Sim­plePie is a nifty API for read­ing RSS and Atom feeds and with it you can grab what­ever feed you like and incor­po­rate it into your own site, or even cre­ate a whole new site with it. The upside to this approach is that it doesn’t mat­ter what you use to man­age your site, so if you don’t use Textpat­tern then you’ve got this as an option as well. Now, for my own site I use the ied_if_domain plu­gin approach, but here’s how you’d do it this way:

  1. Cre­ate your mobi domain (instruc­tions on how to do this at TextDrive can be found here, also created/revised by yours truly)
  2. Down­load Sim­plePie here
  3. Install Sim­plePie in the web root of your mobi domain (at TextDrive that would be either /web/public or public_html). You can find instal­la­tion instruc­tions for how to do this here
  4. Now, cre­ate your PHP page tem­plate for your site using. An exam­ple of how to do this can be found here

And that’s it. There are obvi­ously a lot more steps to it, but you get the basic idea. I’ve been exper­i­ment­ing with Sim­plePie a lit­tle and I cre­ated a Christo­pher Planet of sorts that pulls in feeds from all my sites and ser­vices. It’s a work-in-progress, but at least I’ve found a use for my Horrell.info domain.

1 And I have to say, I love that bloody phone. The inter­face is fan­tas­tic and it’s pretty much every­thing I wanted in a phone.

2 There are some handy Sim­plePie plu­g­ins avail­able for users of Word­Press and Medi­aWiki as well for incor­po­rat­ing feeds, but I have no idea if there’s an ied_if_domain equivalent.

Comments are closed.