Movable Type: How to emulate an MTEntryIfNotExtended tag
June 20, 2013
Tutorials | MoveableType | Snippets | Troubleshooting

Movable Type has a built in container tag  

<MTEntryIfExtended>

which is often used to show the "More" part of a long entry, or anything else that should be displayed only if the entry is extended:

<MTEntryIfExtended>
    <$MTEntryMore$>
   <div>Special text or page elements for Extended Entries go here</div>
</MTEntryIfExtended> 

But what if you want something to show up only if the entry is NOT extended? There is no corresponding <MTEntryIfNotExtended> tag. 

Fortunately that functionality is simple to replicate using Movable Type variables.


Ads by Google

Posted by ellen at June 20, 2013 11:08 PM

Create a new template variable called "isExtended" and set it to 0, which will be the default, unless the entry is Extended.
<mt:Var name="isExtended" value="0">

Add an MTEntryIfExtended container tag, and inside it, change the value of "isExtended" to 1. This means that it will equal 1 only if the entry is Extended.  This must come before the next code block. 

<MTEntryIfExtended>
   <mt:SetVar name="isExtended" value="1">
</MTEntryIfExtended>

Add an mt:If container tag that checks the value of "isExtended" and inside it, add the special text or page elements that should appear only if the entry is NOT extended.

<mt:If name="isExtended" eq="0">
   <div>Special text or page elements for Non-extended Entries go here</div>
</mt:If>

 

Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google