Dynamic Templating
I further discussed my previous post with many pepole and felt I needed to clarify some doubts I and many others had about the new dynamic MT, so here's a follow up post ! Brad explained how the new MT/Smarty/PHP system will work. The template gets pulled from the database; there is a pass over it to make it smarty-compatible; then it gets executed by smarty. so if you have a real simple template like this:
<MTEntries>
<MTEntriesHeader><ul></MTEntriesHeader>
<li><MTEntryTitle></li>
<MTEntriesFooter></ul></MTEntriesFooter>
</MTEntries>
it gets changed to this:
{Entries}
{EntriesHeader}<ul>{/EntriesHeader}
<li>{EntryTitle}</li>
{EntriesFooter}</ul>{/EntriesFooter}
{/Entries}
This is all done on the fly, the only thing stored is your template !
Continuing from yesterday, I asked Brad of a load of questions, comments and thoughts and got many replies.
Q) Will desktop publishing clients like w.bloggar and Zempt require updates to take advantage of or work with the new PHP templating ?
A) No. Absolutely not. The MT interface (and client interfaces, through xmlrpc) isn't changing at all. This has no effect on MT the application. This is just another way to produce the web pages. Dynamic instead of static.
Q) With plugins - new ones - to support dynamic templating will they need to be written in PHP or will they be written in Perl ?
A) Dynamic → PHP; Static → Perl. Simple as that Then I flooded him with questions:
Q) What about permalinks, PHP permalinks are ugly ! Would you use mod_rewrite like WordPress ?
A) There are plenty of options for permalinks. we're ironing out those details still, but you don't have to break your permalinks.
Q) I would imagine that there would be some sort of learning curve if users switched to a dynamic MT. I would assume the MT template code we know and love cannot be used eg. <MTEntryTitle>
A) A misconception that should be cleared up. The MT template syntax is fully supported, the goal was to make the MT templates translate and render in php just as they do under perl.
Q) Just to clarify, we're still going to have individual, category and date-based archives and be able to create our own yes ?
A) Yes. MT's template model is not changing, except that now you can say, i want this template to render dynamically; i want this template to publish statically.
Q) What about text filters, how would they work ?
A) Again with text filters. A PHP and Perl version will need to be created, just like plugins, to enable it to be used in static and dynamic plugins. After that it's real simple. If MT is rebuilding something, it's only going to be using Perl code to do it. If you're viewing the site using PHP (the little index.php file that is running the PHP extension for MT specifically), then it's going to process all the MT tags through PHP. No perl is involved on the dynamic side. If a template is dynamic, MT doesn't touch it. it doesn't have to.
Q) And the learning curve involved in switching to dynamic, will it be easy so that users can just flick it on and off like a switch ?
A) 0 learning curve. but if you're using third party tags, you'll have to take those out of the dynamic templates until they are available as PHP plugins.
Q) What plugins will you be converting to PHP ?
A) Probably all of them, except Perlscript.
Finally a massive thank you to Brad for putting up with my incessant questioning

Leave a comment