Skip to content

Instantly share code, notes, and snippets.

@atstyle
Last active January 4, 2016 05:18
Show Gist options
  • Save atstyle/8573809 to your computer and use it in GitHub Desktop.
Save atstyle/8573809 to your computer and use it in GitHub Desktop.
エントリリストへ、特定カテゴリ用画像を付与する MTML
<mt:SetHashVar name="Compare">
<mt:SetVar name="Category1" value="<img src="http://www.example.com/blog/blogimg/001.gif" />">
<mt:SetVar name="Category2" value="<img src="http://www.example.com/blog/blogimg/002.gif" />">
</mt:SetHashVar>
<ul>
<mt:Entries lastn="999">
<mt:Setvar name="Find" value="0">
<mt:SetVarBlock name="EntCat"><mt:EntryCategory></mt:SetVarBlock>
<mt:Loop name="Compare" sort_by="key">
<mt:SetVar name="imga" value="$__value__">
<mt:If name="__key__" eq="$EntCat">
<li><mt:EntryTitle><mt:GetVar name="imga"></li>
<mt:Setvar name="Find" value="1">
</mt:If>
</mt:Loop>
<mt:If name="Find" eq="0">
<li><mt:EntryTitle></li>
</mt:If>
</mt:Entries>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment