« Reflections on Writing Workflow | Main | How To Make My Day »
January 17, 2005
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?
Posted by rayners at January 17, 2005 12:02 AM
Trackback Pings
TrackBack URL for this entry:
http://mt.rayners.org/mt-tb.cgi/421
Comments
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.
Posted by: Chris Cassell at January 17, 2005 10:45 AM
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?
Posted by: The One True b!X
at February 4, 2005 04:36 PM
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 :)
Posted by: Arvind
at January 17, 2005 03:53 AM