meta

My Drupal coding blogposts

They're now over there, not over here

I've been blogging for a few months now over at the Team Drupal Tumblr. This is one of two tumblrs that Torchbox has set up to serve the internal and external needs of its tech teams.

That means I haven't been blogging much over here. So some of my highlights, if you're interested:

It's probably of greatest interest if you like Drupal; less interesting otherwise. But do wander over and have a look if you get a chance. I might try to duplicate some of the content here, for reference purposes if nothing else; we'll see how that goes.

Blog category:

Reverting back to defaults

Goodbye, custom theme!

After having spent eighteen months trying to get the time to work on a Panels-based Drupal theme, I've finally accepted it isn't going to happen. I need to concentrate more on improving the site and adding functionality. I also want to enjoy the benefits of some of the work we've been doing recently with Display Suite, an alternative, and more lightweight, display engine.

To that end, I've switched back to Drupal's default Garland theme, which I will augment incrementally as and when I need to. This should hopefully mean I can get improvements onto this website sooner rather than later.

Blog category:

Website redevelopment hiatus

I was nearly convinced it wasn't even possible for a while there.

The site redevelopment continues, but somewhat slower. Technology has been the main sticking point, and it hasn't been clear until today whether Drupal (plus the otherwise excellent Panels module) could support exactly what it was I wanted to do. It turns out that it is, but it's pretty difficult to work out exactly how to configure and build the necessary components.

Like working with so many other OS projects, implementing something for the first time in Drupal can sometimes be a frustrating experience; the second or maybe fourth time is so straightforward that you can hardly believe you ever had problems figuring out how it was done. Once I've got some of the key components in place, I'll have to write some howto blogposts alongside descriptions of the rationale.

Blog category:

Upgrading this blog to Wordpress 2.5.1

Finally. Jeez.... Anything broken?

After having been stuck on version 2.0.1 for over two years, I’ve just upgraded to the most recent version, 2.5.1. The only hiccup was needing to ask my web provider to give me a new MySQL database: since 2.5, Wordpress has required MySQL 4.0 or newer.

Otherwise, it all seems to be running very smoothly. Do let me know if you see anything crazy. I hope to upgrade more frequently in future, as it was a far better experience than I’d expected.

Blog category:

Total Eclipse of my broadband

Incidentally, I currently have very little network at home. Eclipse managed to transfer my broadband fine during the house move, and then cancel both my old and new packages simultaneously at the point the old house’s contract expired (December 4). Oddly, although pulling the plug took but a second, reconnecting can take five working days. I’d love to know what they’re currently up to.

In the mean time, when necessary, I’m connecting to an alt-Fon network called something like Liberty Europe. I think they might be communists.

Blog category:

Home is where the heart-shaped souvenir is

Remember in the days before blogs, when we used to have homepages? Well, technically I suppose I still have one, separate from my blog. How retro is that, eh? My online presence is so fragmented (arguably because my offline presence is that of a genre-flitting dilettante who can’t just sit still for five minutes) that the index of www.jpstacey.info is still not my actual blog, even in 2007.

Instead, it’s always been a portal through to existing content—blog, yes, but also short stories, book reviews, the Oxfringe lit-fest and other nonsense—and as such tended to gather dust. Worse than that, I’ve always wanted to put so much of the stuff from my halcyon studenthood there, and have therefore typically run aground creatively after writing two or three pages of copy on the bands I’ve been in and that time nearly eight damn years ago when we did a revue at the Edinburgh Fringe.

Now, though, I’ve redesigned it with a bit more scalability, and minimalism. The index is just a set of slightly Web-2.0ish buttons, all of which lead through to existing sites (although I do need to actually tidy up the navigation on “Other” at some point). That way I’m not condemning myself to writing up my entire past life to this point, of no interest to anyone other than me, my adoring public and the eventual hordes of biographers that will snap and grab in my vast intellectual wake. Or rather: I’m not condemning myself to months of avoiding the very task I mention above.

The tendency when building one’s own website—which a blog neatly avoids, for better or worse, and a CV would never even conscience—is to plan to put one’s whole trophy cabinet online, every bauble and curio. You leave spaces on the shelves for monuments to all the things you’ve done before registering a domain name, but then never remember to unpack them from the boxes in your mental attic. Well, no more.

All roads lead to home

This morning a colleague had hardware problems, and duly googled for 'g200 ubuntu dual head'. Shortly afterwards I did the same, for 'coldfusion introspection "line number"'. We may be on track to produce a zettabyte of data by 2010, but from the looks of it some people are keeping most of it to themselves.

Blog category:

Short story collection: A Pocketful of Lies, December 2006

As a prelude to the relaunch of short-story website Quiet little Lies (a relaunch which is long overdue), I'm distributing in print a seasonal special for 2006 called:

A Pocketful of Lies

An ideal Christmas gift, this handcrafted pamphlet has been lovingly assembled from a dozen complex, thoughtful tales that will vex and puzzle relatives or friends of any stripe! Following your Christmas meal, contemplate what lies beneath the surface of each sinister, questioning story, and thank the stars that your family is indeed relatively well-adjusted after all.

http://www.quietlittlelies.com/

It's free. Just give me your postal address, either via email or via the website (website preferred). I'll try to get it to you before Christmas, but it's not even all assembled yet.

Feel free to pass this on to anyone who you think might be interested. I'd love to get some word-of-mouth interest, although whether I'll keep up with the demands of the photocopier or not is another matter.

Blogthis!

You might notice the little “blog this” link to the right there. That’s my first Wordpress plugin.

The code is at http://www.jpstacey.info/blog/files/code/blogthis.zip. This contains the blogthis PHP code and a directory of images. To try it out (for the moment: I’ll sort this all later into a proper installable plugin) do as follows:

Edit: full documentation now available at http://www.jpstacey.info/blog/files/code/blogthis_doc.html.
Edit: made plugin extensible, with admin page and configurability of blog list, images location etc.

  • Unpack the zipfile to a safe location - it should create a “blogthis” directory.
  • Move the “blogthis” directory to your blog’s plugin directory, typically at wp-content/plugins/.
  • Enable the plugin in Wordpress: once you’ve done that you should see a “Blogthis!” link appear in the plugins sub-menu which links to its admin page
  • In your theme’s templates, add the following bit of PHP where you want it to appear in the index template (within the blog entry chunk):

<?php if (function_exists(’wp_blogthis’)) wp_blogthis(); ?>

By default, the following XHTML fragment should be created:

<div class=”blog-this”>Blog this:
    <ul class=”blog-this-links” >
        <li><a href=”. . .”><img> Link text</a></li>
        . . .
    </ul>
</div>

The containers can all be edited in the code: if you change the list tags to HTML div tags then it should still understand what’s going on, even if you add classes. I recommend making the following styling and HTML decisions (although of course it’s all up to you!)

  • Putting the links in a list (and then turning that list into a div-like structure using display:block in the CSS) is the most accessible way to present the content. People using screen-reader technology will see the title, and can then decide to ignore the list. Almost all common screen-readers ignore HTML div structure completely.
  • You can set the styling of the li elements to be display:inline to make the list appear in a line.
  • Alternatively, as I’ve done, set the links container’s styling to be display: none by default. You can then set the div:hover styles for both hovering over the blogthis container and the links container. That means as you hover over the outermost container, the links appear; when you move into the links container, it doesn’t disappear!
  • To get hovers to work in IE6, use the behavior: url(csshover.htc) trick described on Peter Nederlof’s blog.
  • CSS gurus: my current theme’s CSS is at http://www.jpstacey.info/blog/wp-content/themes/pool/style.css, a hacked version of Borja Fernandez’s Pool.

From what I can gather since, I’ve partly reinvented the wheel of Cal Evans’ wp-notable plugin. I think my system is more configurable, though, as you can add and remove blogs you want to submit to. I’m hoping to continue to develop it to be too, so watch this space. Certainly I’d like to bring in more up-to-date considerations like accessibility and XHTML as and when I can. Please give me feedback: I’d love to hear of any suggestions or successes!

Rolling feed on jpstacey.info

Following my recent success with putting a Flickr feed on my website’s front page is the conversion of this to an all-purpose feed reporter, where RSS/Atom flavour and feed specifics are dealt with by Javascript associative arrays of functions, keyed on both variables respectively.

If you’re lucky then the feed should wait a bit while it loads the XML via Javscript’s XMLHTTPResponse() code (querying proxies all on my website for foreign feeds like del.icio.us). Then it will report the first feed it finds, while still loading other feeds in the background. Every 15s or so it swaps to a new feed.

After writing it easily in Firefox, I found that a number of drastic changes were required for IE, as follows:

  1. IE doesn’t seem to have great support for the IMG element’s width or height properties, at least before the image is rendered on the page. For the Flickr feed, if imgElem.width == 0, I’ve had to employ some horrible regular expressions on imgElem.outerHTML (which isn’t supported by non-IE browsers, so it’s all a bit of a hack).
  2. IE doesn’t support assigning arbitrary properties to elements. I was using these to smuggle a collection of titles and descriptions (keyed by date) into a function and that of course failed. You can use setAttribute() for string-like properties, but not objects, which I’ve had to pass as parameters or in some reserved scopes.
  3. IE is very unforgiving about character encodings, behaviour which I haven’t been able to work around yet. Some of the programs that create my feeds (specifically Blosxom) aren’t very Unicode-wise and hence will happily produce invalid content. Firefox is very forgiving of this (which may or may not be the right XML way to do it, but is certainly a very patient way of dealing with web content generally). I’m currently working on my proxies to sort this out somehow, even if I have to filter everything down to the ASCII character set.

The Javascript is a single, monolithic file which relies on a beta-release version of Mochikit, and is available at http://www.jpstacey.info/index/javascript/index.js. Feel free to scrape it and re-use anything you find interesting there.

Pages

Subscribe to RSS - meta