New Plugin Idea: Template Preview

So, I was doing some testing on a quickie little plugin that I wrote to help out a reader. It occurred to me that having to create a template and keep rebuilding it while I was testing a single template tag was a little silly. Why not have the ability to just toss the text into a form field, click a button, and get a rendering of that template text? I could write that without too much difficulty.

And then I could add features. Like previews for existing archive templates so that changes could be tested before the entire site is rebuilt. Things like that.

Any other ideas out there?

3 Comments

Also a more sophisticated entry preview mode would be nice whereby when we hit preview, the page generated contains say the individual archive template code applied and it looks how it would look like live.

Apart from that this is a brilliant idea :)

You could just use the mt-view.cgi that's provided with MT. It's experimental and unsupported, but does provide this functionality. Just save your template and refresh the dynamic page.

General usage is: http://your.site/path/to/mt/mt-view.cgi/[blog_id]/[page to view]

To view the homepage, set [page to view] to index.html or whatever file your homepage template writes to.

To view an individual entries, change [page to view] to entry/[entry id]. For example: http://your.site/mt/mt-view.cgi/1/entry/10

To view categories: change [page to view] to section/[category id]

To view date-based: change [page to view] to archives/[4-digit year]/[2-digit month]/[2 digit day (optional)]

Other pages are viewable by changing [page to view] to the output file. One notable exception: if your archives index is at archives/index.html, it won't work because the script expects a date.

I know that for entries, you can specify a different MT template by tacking on the template name at the and of the mt-view.cgi URL. But this functionality does not appear to exist for pushing date-based archives through mt-view.cgi -- anyone know how to make that happen?

Leave a comment

Recent Entries

  • Plugin Writing 101

    So, I’m planning on writing up some entries about various aspects of plugin development. While I have a couple topics already in mind, I thought...

  • The Olympics Make Me Want To Compete Again

    Every time the Olympics come around (most the summer ones) I always start to delude myself into thinking I could complete once again in the...

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

Close