Just a day after 1.02, I've released version 1.03 of my “file-based posts” plugin for WordPress. It still allows you to compose/edit posts with your favorite editor instead of the tiny textarea box in a browser, but there are several new goodies with this version.
I added many of the goodies while figuring out how to incorporate Y!Q into my blog. Y!Q is a service by Yahoo! which allows me to include contextual “search for more about this” links into my prose.
As an example of Y!Q, consider that I'm talking about Anthony's favorite stuffed friend, Curious George. Notice how the phrase “Curious George” has been highlighted? If you click on it, you should see a popup with Yahoo! search results for more info about the little monkey. (Use the [ESC] key to remove the popup.) I think I'll add this “quick link to more info” feature to my future posts, from time to time, when I think it will make the reading experience better.
Anyway, back to my plugin, after taking advantage of some of the new things in v1.03, I've been able to set up an include file YQ.html which allows me to create a Y!Q link as simply as:
<fbp_include set text='Curious George': YQ.html>
or more complex, such as the
<fbp_include set text='Curious George'
set focus='books'
set context='Curious George is a curious little monkey': YQ.html>
which that I actually used above.
Here's a look at the contents of the YQ.html file:
<fbp_var fallback=terms: text>
You can see the reference to many set-at-include-time variables, such as the text we used in the first example above. These many variables reflect the many ways Yahoo! allows the developer to customize and target the results (see “Step 4” of the Y!Q Developer Docs). You can also see some interesting attributes to the <fbp_var> calls, such as fallback and doublequoted. (See the plugin's home page for details on what these mean.)
For completeness in case you'd like to use this yourself, here's the YQ_head file referenced from the first line of YQ.html:
<script language="javascript" type="text/javascript" src="http://yq.search.yahoo.com/javascript/yq.js"></script>
Finally, here's something cool. I've included the above files in this post with the following:
<pre style="..."> <fbp_include uncounted cooked: YQ.html> </pre>
This shows the new uncounted and cooked attributes to <fbp_include>.