Friday, 27 November 2009

Making titles look right

A mixed-case title presents problems with vertical alignment: if none of the letters have a "descender" -ie the title does not include any of g j p q y - then you may want to sit the title lower on the page than if it does.

Here is a simple php function to check whether a string includes a descender:
function hasDescender($thisString){
    return (preg_match("/[gjpqy]/", $thisString));
}

Saturday, 7 November 2009

Scriptaculous Sortables - this.observer is not a function

Hit errors with the error message "this.observer is not a function" when releasing a dragged object using the excellent Sortables function from scriptaculous.
Much grief before I eventually found the problem: where all the other options settings require the value to be in quotes, the "onUpdate" parameter requires the function name NOT to be quoted
.

So - use onUpdate:showList not onUpdate:'showList'