QueryPath Blogs
Data URLs and QueryPath: How to embed images into XML or HTML
QueryPath 2.1 is adding support for writing files directly into URLs using Data URLs. What this means is that you can encode and embed images or other documents straight into your HTML or XML.
Here's a simple example from the QueryPath 2.1 unit tests:
<?php $xml = '<?xml version="1.0"?><root><item/></root>'; qp($xml, 'item')->dataURL('secret', 'Hi!', 'text/plain'); ?>The above will generate an XML fragment that looks like this:
<?xml version="1.0"?> <root> <item secret="data:text/plain;base64,SGkh"/> </root>The important part there is the attribute secret="data:text/plain;base64,SGkh. This attribute includes an embedded text document with the contents Hi!. What we've done is encode the data and injected it as a document inside of the XML.
Sure, that's novel... but what would we want to use that for? How about adding images directly into a document?
Reflections on Google Summer of Code
This was the second year that I have been involved as a mentor for Google's Summer of Code program. And in both cases, I've worked as a mentor for Drupal. Last year, I worked with sivaji on a project involving the Quiz module. This year, I worked with eabrand on QueryPath and the QueryPath module.
In both cases, the projects were highly successful. I'm thrilled to have had the opportunity to work with two very gifted up-and-coming developers.
I think one of the most critical questions to ask of any program like GSOC, is whether or not it produces the results (pedagogical and professional) that it is after. With both Sivaji and Emily, the answer is a resounding yes.
- Since finishing his GSOC project, Sivaji has begun his professional life as a web developer focused on Drupal. Recently, he and his colleagues started E-ndicus, a Drupal-focused software development company in his home town of Chennai.
- Emily is now a software engineer at HP. She continues to contribute to QueryPath, and was just this week featured on Google's blog. Last week, she joined me on the Drupal Dojo QueryPath session, too.
I doubt either of these individuals learned much from me during our GSOC projects. More than anything, it just takes hard work, persistence, and attention to detail to finish a GSOC project. But I've certainly learned a lot from them. And both Quiz and QueryPath have benefited enormously from the work of these two.
Slides for my Dojo presentation: "QueryPath: It's like PHP jQuery in Drupal!"
I posted the slides from yesterday's Drupal Dojo presentation. These should be much more readable than the video feed.
QueryPath: It's like PHP jQuery in Drupal! View more presentations from Matt Butcher.Drupal Dojo: "QueryPath: It's like PHP jQuery in Drupal!"
On August 17th at 12pm EDT (9AM PDT), I will be doing the Drupal Dojo session, "QueryPath: It's like PHP jQuery in Drupal!". To sign up, head over to the webinar signup.
I'm particularly excited about this for three reasons:
- Emily will be joining me to talk about her GSoC project.
- We will be discussing QueryPath 2.1 and the new Drupal 7 QueryPath module.
- The totally gorgeous new QueryPath logo (designed by Michael Mesker) will be unveiled.
This has been an exciting summer for QueryPath, and this webinar will preview many of the QueryPath technologies that are on the cusp of being released.
A PHP jQuery Library: QueryPath Overview
jQuery is a JavaScript library for efficiently working with HTML and CSS. Its chainable and compact API has made it a popular choice for web developers seeking to quickly build rich web applications. But did you know there is a PHP jQuery library? QueryPath is a PHP implementation of jQuery's interface. It provides all of the DOM manipulation functions, a full CSS selector engine, and as much of jQuery's other features as is practically implemented server-side. But that's not all. This powerful library delivers many server-side features designed to make working with XML services simple, robust, and reliable.

