Dumping ADT+WCM Template Variables

Ever wonder what exactly is available to you as a WCM Template author, or ADT wizard, or Theme developer? Ever forget the name of that weird request variable that gives you the current URL? Or wonder what happened to VelocityVariables in 6.2? Of course you have. Well, wonder no more! With this handy context dumper, you can see all of the available utilities, variables, their values, and their callable methods from your template, ADT, or theme context. Here's what it looks like:

It also dumps a hierarchical view of the request variable at the bottom of the listing, for ADTs and WCM Templates:

Just copy and paste this code into your theme (should be compatible with 6.2 and 6.1), ADT or WCM template, and explore. If I had more skills as a designer I'd make this into some kind of auto-expanding AlloyUI table with music. But I don't, so I can't. Any volunteers?

 

Special thanks to Chaquotay for the base code. I had to modify it because if you try to do a deep expansion of everything (i.e. the .data_model special variable), it opens a black hole in your server as it recursively tries to expand everything in the universe.

Blogs
Hi, this is indeed very useful! I have been able to use pieces of it but having problems with the "<#assign foo = something.in["your"].data[0].model />" concept in your note. I know for example, that a ADT for a Journal display has the container <#list entries as entry> available. But this does not seem to work for an web-content-display template and what else is available? I found from your code that 'request' is available and can parse that with freemaker. When a web-content-display template is invoked is the 'article' passed in as a container (or an article id that is supposed to be used in an #assign and then regular freemarker can kick in?)? I've seen the examples of reserved-words use but seems to be just as one-off special cases. Is there not a container for them (e.g. ${reserved.user_id}) so that the freemarker 'way' can be maintained?
ok; found this bit of generic fm that returns the data model;
<#list .data_model?keys as key>
${key}
</#list>
Now just have to figure out if what I need is in there somewhere.