Come to the 2010 CMS Expo

javascript

Dave Hall: Review of "Drupal 6, JavaScript, and jQuery"

Dave Hall recently reviewed my Drupal 6, JavaScript, and jQuery book.

Dave Hall's BlogDave Hall's Blog

I found this observation particularly apt:

This book is definitely not for the copy and paste coder, nor the developer who just wants ready made solutions they can quickly hack into an existing project. Some may disagree, but I think this is a real positive of this book. Matt uses the examples to illustrate certain concepts or features which he wants the reader to understand. I found the examples got me thinking about what I wanted to use JS and jQuery for in my Drupal sites.

This is what I want to accomplish in the book. My goal is to get coders thinking about what they can do (and how they can do it) rather than simply re-using code. I'm so glad that Dave noticed this and brought it into focus. If you are interested in taking a peek at the book, you can download one of the chapters.

Using Flashy to Play Video inside Lightbox2

By default, the Drupal Lightbox2 module supports the flvPlayer flash movie player, which is not Open Source. However, Drupal has a 100% Open Source video player called Flashy. Here's a quick method of overriding Lightbox's setup to use Flashy instead of flvPlayer. Update: Fixed for Internet Explorer.

Chris Shattuck's review of Drupal 6 Javascript and jQuery

Chris Shattuck wrote a review of my Drupal 6 JavaScript and jQuery book. It is an insightful review, and will certainly influence what I do in the second edition. One of the commentors on the blog noted that the review was very detailed and must have taken a long time to write. I agree. Thanks, Chris, for taking the time outlining and evaluating.

While the review was mostly focused on the content of the book, my favorite quote is this:

I was excited enough about the new stuff I learned that I picked up a module that had been languishing for a while and re-wrote a bunch of the code using the principles addressed in this book.

It makes me happy to know that the book prompted people to write (or re-write) code.
David Shattuck ReviewDavid Shattuck Review

Review of "Drupal 6 JavaScript and jQuery"

Kat Bailey posted a very kind review of my Drupal 6 JavaScript and jQuery book.

From the review:

The book aims to get people with little to no knowledge of Drupal or JavaScript up to speed with creating really awesome functionality, really fast. In fact, its title almost belies the breadth of its scope: although the use of jQuery in Drupal 6 is the one topic that it covers exhaustively, it doesn't skip over any of the basic tools or concepts required to get going with Drupal, and so it would work pretty well as a first Drupal book for any aspiring front-end Drupaler. It covers everything from the ultra-utra-basic ("what is CSS?", "what is a Drupal block?") to Drupal JavaScript Behaviors (and everything else in drupal.js), to JavaScript Theming, to AJAX, to building modules with AJAX functionality, to jQuery syntax, effects, and even writing jQuery plugins!

I've spent the last week or so doing nothing but writing Drupal-centered JavaScript. Every time I reflect back on what JavaScript coding used to be like, I can't help but appreciate the hard work of the jQuery and Drupal JavaScript teams.

Presentations from Drupal Camp Wisconsin

DrupalCampWIDrupalCampWILast weekend, I joined a couple hundred other Drupal users at Drupal Camp Wisconsin at the University of Wisconsin, Madison. This well-organized two-day event was fantastic. I met many new people (and can now connect a face with an IRC handle for many more). And the crack team of conference organizers have already put together videos of many conference sessions.

For me, the conference highlights included a handful of sessions on Drupal in education, a pair of sessions on GIS and mapping, and a BOF that I attended on web services, portlets, and the future of distributed web applications. A perennial strong point for Drupal Camps is the coverage of Drupal basics. DrupalCampWI had around half a dozen sessions for beginners. If you are just learning Drupal, a camp like this can really help you find your footing.

The camp's commons area was fantastic, providing ample space for both small and large BOFs as well as impromptu brainstorming sessions. Many conferees stayed at the same hotel, making after-hours ad hoc get togethers easy. And Wisconsin food? I ate my first (and probably last) "bacon bratwurst pretzel burger with cheese."

I gave two sessions. The first was on JavaScript and jQuery in Drupal. The second was on Web Services, mashups and QueryPath in Drupal (a preview version of what I hope to show in Paris this September). Most of the conference sessions are now available in video form.

Update: Added link to QueryPath video

Escaping JavaScript in QueryPath

Sometimes the HTML you parse with QueryPath will contain JavaScript or other embedded scripting languages. And sometimes such scripts will contain characters that the XML parser might misinterpret as XML or HTML structures.

There are two ways to escape such content -- both of which are standard, and are often done regardless of whether or not you are using QueryPath.

The first method, which is preferred when working with HTML, is to enclose any scripts inside of HTML comments:

<html>
<head>
< script>
<!--
// Script goes here
-->
< /script>
</head>
<body></body>
</html>

(Extra spacing has been added in the example above to keep the tags from being stripped by this blog's formatter. Those spaces should not be present in your code.)

The comment enclosure will prevent the HTML parser from parsing the contents of the script.

In other cases, XMxmlL CDATA sections may be a better fit for your needs:

<html>
<head>
<![[CDATA
// Script goes here
]]>
< /script>
</head>
<body></body>
</html>

CDATA sections will be readily available in the parsed DOM, but the contents of a CDATA section will not be parsed and interpreted. It is therefore safe to embed JavaScript as well as XML/HTML-like tags.

With these two strategies, you should have the tools necessary to prevent embedded scripts from causing QueryPath parse errors.

CMS Expo Sessions

SDR News interviewed about a dozen or so speakers at the CMS Expo conference. These are slowly being made available at the SDR News website.

The primary QueryPath interview is not currently posted. However, the lightening talk that I gave just before the keynote is available.

The audio is not very good. Here's hoping that the audio for the QueryPath session is better.

CMS Expo Presentations

At the end of April, I will be presenting two sessions at the CMS Expo.

Session 1: JavaScript and jQuery

This session will begin with a survey of JavaScript usage. We will then cover jQuery in some detail. From there we will move on to a more general discussion of how CMS systems can benefit from JavaScript integration. The last part of the discussion will discuss some of the new and exciting features in recent browser development, and explore how those are changing the way CMS systems will interact with clients.

Session 2: QueryPath

This session will introduce the QueryPath library. We will see why a library like QueryPath is necessary, what it does, and how it works. I will be showing demonstrations of tools that can be built (quickly) in QueryPath, including Twitter integration, Amazon and SPARQL queries, and a as-of-yet-unveiled mashup featuring an exciting new web service.

IE XMLHttpRequest, RSS feeds, and fixing it with Apache mod_rewrite

On occasion I have run into a strange problem, both with the RSS JavaScript widget downloadable from aleph-null.tv and with the code I wrote for Drupal 6 JavaScript and jQuery: Under certain conditions, the script simply does not work on IE 6, and IE 7. Firefox, Safari, and such don't seem to have this problem at all.

After a whole lot of digging, I found the problem, and devised a solution that will work out of the box with Apache (and with a little tweaking, it should work with other webservers, too).

jQuery plugin and Drupal module for embedding Flash files

Today, Palantir.net is releasing several module that we built as part of our client work. One of these modules is the SWF Embed module. With this module, developers can create tools that include flash objects.

This module makes use of both PHP code and JavaScript code in order to provide robust Flash integration used in projects like the Flashy Drupal video player. But from a developer's point of view, all you need to do to add Flash support is create an object and theme it. The SWF Embed handbook page describes this process in detail (not that there is a lot to describe).

But there is a hidden gem in there that may come in handy for your non-Drupal sites (if you believe in such a thing).

Syndicate content

Recent comments