ContentVampire 1.0.1-beta

ContentVampire 1.0.1-beta

Released Jun 19, 2012 by aladage

A plugin that extracts all image and link paths and attributes from a page's Content field, and saves them uniquely in a TV as a JSON string.

Download 3kb (1137 downloads)
Downloads: 1,135
License: GPLv2
Requires Revolution 2.2.x or greater
Compatible up to Revolution 2.2.x
Supports mysql

A WYSIWYG is a black hole of content. Images, files and links added to a rich text editor by your site editors are traditionally very hard to work with programmatically -- until now!

Whenever a page is saved, ContentVampire scans through the page's content section, finds all image and link tags in the HTML, and then compiles all of those tags' attributes into a structured JSON string. The JSON string is then saved to the "vampireValues" template variable, making it very easy to programmatically work with your site editors' content (think image galleries, file lists, etc.).

For example, a page containing a single placekitten image, and a link to, would be saved to a TV like this:

{"images":[{"iteration":0,"src":"http:\/\/\/g\/200\/300","alt":"Placekitten","title":"This is a cat"}],"links":[{"iteration":0,"href":"http:\/\/","target":"_blank","name":null,"title":"I Can Haz Cheezburger!"}]}

This is the initial release (and my first plugin attempt, so be gentle). Future versions will include support for scanning Rich Text TVs, too.

Installation Instructions

  • Install the extra via package management. This creates a plugin attached to the OnDocFormSave system event.
  • Create a new Template Variable named "vampireValues" (or whatever you want, but a different name requires changing the plugin property) and assign it to whatever templates you want this plugin to work with.
  • Enjoy! Whenever a resource is saved, all image and link elements in the content area will be saved uniquely as a JSON string in the vampireValues TV.
  • 1.0.1beta: updated description. Nobody had a clue what the hell this plugin did ;-)

    1.0.0beta: Initial release