• MODX.com



ContentVampire is an extra by aladage, first released on 2012-06-07.

Package Description

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 icanhazcheezburger.com, would be saved to a TV like this:

{"images":[{"iteration":0,"src":"http:\/\/placekitten.com\/g\/200\/300","alt":"Placekitten","title":"This is a cat"}],"links":[{"iteration":0,"href":"http:\/\/www.icanhazcheezburger.com","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.

Usage/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.


First seen
Supported databases
Minimum MODX Requirement

ContentVampire Releases

Vendor Signature Released on
MODX.com 1.0.0-beta1 2012-06-19 (8 years ago)