/mt-layout-slot

Movable Type plugin to enable layout and slot style template writing.

Primary LanguagePerl

mt-layout-slot

Movable Type plugin to enable layout and slot style template writing.

Getting Started

Create a new template module named 'BasicLayout' to use as a layout.

<html>
<head>
<title><mt:Slot name="head_title" append=" | " desc="Document Title">My Blog</mt:Slot></title>
</head>
<body>
  <mt:Slot name="html_body" desc="Document Body"></mt:Slot>
  <mt:Slot name="html_footer" desc="Document Footer">&copy; ideaman's Inc.</mt:Slot>
</body>
</html>

Then create a new index template to use this layout.

<mt:Layout module="BasicLayout">
<mt:Slot name="head_title">Top Page</mt:Slot>

<mt:Slot name="html_body">
  Here is body.
</mt:Slot>
</mt:Layout>

The result of the index template is like this.

<html>
<head>
<title>top Page | My Blog</title>
</head>
<body>
  Here is body.
  © ideaman's Inc.
</body>
</html>

If you use mt:Slot in mt:Layout, original mt:Slot tags in layout module will be replaced by name.

To use content of original slot, skip to write mt:Slot tag in mt:Layout.

Tags

<mt:Slot></mt:Slot>

Defines of replace partial. If used in mt:Layout, the original slot is replaced. Or not in mt:Layout, defines a alot.

name

Required to name of the slot.

trim

Trim white spaces on both of the sides of content.

Default is 1(true). Set 0 or empty not to trim.

<mt:Layout></mt:Layout>

Use a module or file as layout.

Modifiers are compatible with mt:Include tag.

<mt:IfSlotted>

Check if a value already filled.

name

Required to name of the slot.

<mt:SlotHeader></mt:SlotHeader> and <mt:SlotFooter></mt:SlotFooter>

Use in mt:Slot tag to define header and footer of the slot.

If the contents of the slot is not empty, they will be displayed.