PHP

JS Error Logger for Drupal5 pre-release

This is a pre-release of a Drupal 5 module which allows you to record JavaScript errors from visitors either to the Drupal log, or (if you're really keen to hear about it!) have immediate notifications sent by email.

On the Paper Fish website, we use jCarousel to display a carousel of similar products. It works really well, but for some Safari users it gave a strange error, which was proving hard to reproduce on our test machines. In order to leverage the users visiting the site in order to test the system more completely, we produced this module.

Modified version of CiviCRM_Error module for Drupal

Attached is a copy of civicrm_error.module 1.1 for Drupal 5, modified to give slightly more readable output by email and also log via watchdog.

Thanks to Advomatic for the excellent tool!

Drupal5/CiviCRM2.x civicrm_error.module

Google Sitemaps Exclusion for WordPress

With a WPCMS site, some pages are "special" pages - order return pages and error pages for example - which you might not want included in a sitemap. Likewise, some sites have a page which has a lot of additional content based on the variables supplied (an example of this is the Dog and Lemon Guide's Japanese Vehicle Recall database, which lists recalls affecting 46,000,000 vehicles from 21 car companies).

Make Wordpress default to pages, not posts

For a few sites, I've used WordPress as a CMS, and if you're using lots of pages and few posts, the default menu arrangement is a little leftwards. So here's a simple plugin that makes WordPress default to creating Pages (not Posts) when clicking the "Write" menu, and list Pages (not Posts) when clicking the "Manage" menu.

That's all it does. Download it and use it: xb Pages Are Default

Favatars 2.1 (favatise speed boost)

Frog Blog uses Favatars, a favicon.ico / avatar plugin. Recently (after a server upgrade) we had to rebuild the favatar index on 25,000 comments, and this ... was going to take a while. About seven hours. Ugh.

After a look at the favatars code, it was pretty obvious what needed to be done. So here, thanks to the environmentally conscious open source movement, is a much faster favatars.php. (More like five minutes. Aaah.)

Tag Me Out

This plugin, xb Tag-Out Regex Wrestling Teammate, allows you to cast a steely samurai gaze over a given post and extract in an instant the tag you seek.

Say, for example (this is what I made it for), you have a post with an image in it. You want to yank the image (tag) only, and display that in a query somewhere else. You need this plugin and a line of code like this inside the loop that will show your extracted image:

<?php echo xb_extractor("<img[^>]*>"); ?>

Paperfish goes live

Paperfish's new website is live this evening! I'm quite stoked with it. The design is a fairly simple template which uses a series of gentle water images in the header, and they crossfade nicely using some very sexy Javascript and CSS manipulation.

I threw this together using the YUI toolkit and a lot of fooling around to get it to behave right. I think the overlaid images are still a single pixel out (to the right), but the effect is lovely.

Font size in WordPress TinyMCE

Paul from MiC requested a font size selector in his WordPress TinyMCE config. Turned out to not be so hard after all ... this change was to WordPress 2.0.4

  1. Edit wp-includes/js/tinymce/tiny_mce_gzip.php
  2. Find the line which contains $mce_buttons = apply_filters('mce_buttons', array( /* lots of options here */ ) ;

emacs php folding

I found myself needing code folding in PHP5 again, and switched to TextMate for a few days. But it just doesn't handle things right ... nice UI, but it inserts a <% %> every time I press ^x which drove me nuts. So I worked out how to make code folding for PHP5 work in Aquamacs, and here it is (for your .emacs).

(defun show-onelevel ()
"show entry and children in outline mode"
(interactive)
(show-entry)
(show-children))
;;
(defun cjm-outline-bindings ()
"sets shortcut bindings for outline minor mode"
(interactive)

x-Dashboard hacks

x-Dashboard is a plugin for WP which replaces the default Dashboard (WordPress dev blog + your recent updates etc) with a modular display of ... whatever you want.

Until now, I've been replacing the default wp-admin/index.php with a friendly menu - most of the sites I set WP up on are for people who don't know what a blog is, and don't care either. So why am I giving them WordPress?

  • It's simpler than Drupal, and you don't have to understand nodal information networks.
Syndicate content