August 12, 2011

Advanced Templates: Global Tags

When using Advanced Templates, global tags can be used in conjunction with other tags (like date formatting, post tags, etc.) to force case, strip HTML tags, and so on.

Advanced Template Set designs are available with the Unlimited, Premium, and Business Class plans.

remove_html
Strips all HTML from the contents of the tag.
Example usage:
<$MTEntryBody remove_html="1"$>
upper_case
Forces uppercase for characters in tag.
Example usage:
<$MTEntryTitle upper_case="1"$>
lower_case
Forces lowercase for characters in tag.
Example usage:
<$MTArchiveDate format="%B" lower_case="1"$>
Tip: This tag is good for making AM/PM display as am/pm.
trim_to
Trims the tag value to the first N characters, where N is specified as the value of the attribute.
Example usage:
<$MTEntryTitle trim_to="N"$>
encode_xml
Properly encodes content for use in an XML document and is used in the Atom and RSS feed templates
Example usage:
<$MTEntryBody encode_xml="1"$>
dirify
Converts tag to all lower-case, strips non-alphanumeric characters, and converts spaces to underscores. Good for converting content to a form suitable for use in a file or directory name.
Example usage:
<$MTCategoryLabel dirify="1"$>
encode_html
Ordinarily, HTML code in a post is parsed and displayed with the specified formatting encode_html forces it to display with the code.
Example usage:
Post is entered as <b>bold</b>, displays normally as bold. Using <$MTEntryBody encode_html="1"$> causes it to display as <b>bold</b>
encode_js
Similar to encode_html but with Javascript code.
encode_url
Encodes content suitable for use in a URL. For instance, a space becomes %20
Example usage:
<$MTEntryTitle encode_url="1"$>
decode_html
Displays with formatting if HTML entities are present in post.
Example usage:
Post is entered as &lt;b&gt;bold&lt;/b&gt;, displays normally as <b>bold</b>, <$MTEntryBody decode_html="1"$> causes it to display as bold.
decode_xml
Similar to decode_html but for XML entities
zero_pad
Displays the content with the specified N number of digits, pads with zeroes if the content is fewer than N digits.
Example Usage:
<$MTEntryID zero_pad="N"$>
sanitize
Strips out all HTML tags except those specified.
Example usage:
<$MTEntryBody sanitize="em"$> will remove all HTML except the <em> tags in the content, which will display normally.
Search


Need design help?

Looking to launch a new blog? Have an itch to tweak your design or layout? Want a superior banner or design custom made specifically for your blog? We've got you covered!

Typepad Services badge