Output default thumbnail in Movabletype 4
24th Aug. 2009
In a recent website redesign I wanted to have a simple article photo thumnbnail beside the title in a recent articles list placed in the site's sidebar.
Using Movabletype 4's asset manager this is relatively painless to implement unless their happens to be no assets associated with that entry. In that case MT will output the title without thumbnail.
What I want to happen is MT to output a default thumbnail in those instances.
I spent a couple hours trying to get this to work until a kind member of the MT community forums gave me the template code below:
<mt:SetVarBlock name="fallbackthumb">[FALLBACK CONTENT]</mt:setvarblock>
<mt:Entries>
<mt:EntryAssets setvar="postthumb">[DESIRED CONTENT]</mt:entryassets>
<$mt:Var name="postthumb" _default="$fallbackthumb"$>
</mt:Entries>
This is how mine looked after replacing the bracketed content.
<ul class="featured clearfix"><mt:Entries lastn="8"><li><a href="<$mt:EntryPermalink$>"><mt:SetVarBlock name="fallbackthumb"><img src="<$MTBlogURL$>img/default.jpg" /></mt:setvarblock><mt:EntryAssets setvar="postthumb" type="image" limit="1"><img src="<mt:AssetThumbnailURL width="70" />" alt="<mt:assetlabel>"/></mt:entryassets>
<$mt:Var name="postthumb" _default="$fallbackthumb"$><strong><$MTEntryTitle$></strong></a></li>
</mt:Entries></ul>
Search
Recent entries
- Explaining Information Architecture
- Prototyping the Julian Scarf
- Making of the Computer Graphics for Star Wars (Episode IV)
- Experibass
- Reac Table
- John Cage about silence
- The Fragmented Orchestra
- Voltage
Old articles
- Escaping Flatland: Towards Better Documentation for Information Architects (Eng./Chinese)
- Audio Interfaces for Online Environments
- Mental Models for Producers
- User Experience for Producers
- Information Design: An Introduction
- Visual Design for the Web
- Creating the User Experience
- Digital Story Telling
- Introduction to UX: Foundations, Navigation& Information Design, Information & Visual Design
