Movable Type Template Layouts Toolkit
NAME
Movable Type Template Layouts Toolkit - A framework for making reusable template layouts into tags.
VERSION
0.3
SYNOPSIS
use MT::Template::Layouts;
MT::Template::Layouts->add_layout(FeedModule => &feed);
sub feed {
<<TMPL
<MTInvoke tag=MTFeed pass_thru=uri>
<MTInvokeContents>
<h2><$MTFeedTitle encode_html=1$></h2>
<ul>
<MTInvoke tag=MTFeedEntries pass_thru=lastn offset>
<MTInvokeContents>
<li>
<MTInvoke tag=FeedItemInclude pass_thru=description></MTInvoke>
</li>
</MTInvokeContents>
</MTInvoke>
</ul>
</MTInvokeContents>
</MTInvoke>
TMPL
}
DESCRIPTION
MT Template Layouts Toolkit is a framework for making reusable template layouts out of other template tags.
This began as a proof of concept with a few goals in mind:
- The ability to better reuse and distribute common layout modules used in contructing weblog designs.
- The ability to rapidly assemble the structure of a weblog
- Cleaner more maintable modular templates.
Future steps include the libraries of common (and not so common) layouts and integration with the WidgetManager.
TAGS
- MTInvoke [tag= pass_thru=]
A container tag that creates the context for a tag to invoke. All other tags in this module must be contained in this one. The tag being invoked can be optional defined using the
tagattribute. If atagattribute is defined aMTIvokeTagmust be contained within the this tagset. - MTInvokeTag
A container tag that sets the name of the tag being invoked.
- MTInvokeContents
A container tag that holds the contents of a conditional or container tag being invoked.
- MTInvokeSetArg name=
A container tag that sets the value of an attribute defined by the
nameattribute which is required. - MTLayoutArgument name=
A variable tag that outputs the value of an argument use to call the layout tag. The attribute
nameis required and defines which argument to output. - MTIfLayoutArgument name= [, defined=, eq=, ne=, lt=, gt=, le=, ge=]
A conditional tag the will build its contents if the value of an argument used on the layout tag is true. This tag requires a
nameattribute that specifies the argument to compare.To evaluate if a argument was defined (was present in the call of the layout tag) used the
definedattribute with a true value such as 1.To evalute how an argument compares to a value the
MTIfLayoutArgumenttag use eithereq,ne,lt,gt,le, andgeattributes passing in the value you want to compare. These attributes work like their Perl language counterpart.eq equals ne not equal lt less than gt greater than le less than equal ge greater then or equal - MTUnlessLayoutArgument name= [, defined=, eq=, ne=, lt=, gt=, le=, ge=]
A conditional tag the will build its contents if the value of an argument used on the layout tag is false. This tag performs the opposite operation of
MTIfLayoutArgumentwith all the same attributes.
ISSUES
- An automatic way of loading layouts when needed using
Module::Pluggable.
use Module::Pluggable require => 1, search_path => ['MT::Template::Layouts']; - MT::Template::Layouts->plugins;
- What should the scope of layout token cache be? system or request? Currently system.
- Is error handling sufficient?
AUTHOR & COPYRIGHT
MT::Test is Copyright 2006, Appnel Internet Solutions, LLC, http://appnel.com/. All rights reserved.
