Created
February 21, 2011 20:56
-
-
Save nataliepo/837691 to your computer and use it in GitHub Desktop.
i always forget the syntax for mt templates using the <mt:for> tag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="gallery"> | |
<mt:setvarblock name="num_assets"><$MTNumAssets$></mt:setvarblock> | |
<mt:setvarblock name="num_assets"><mt:var name="num_assets" op="++"></mt:setvarblock> | |
<!-- num assets = <mt:var name="num_assets"> --> | |
<MTIfHasAsset placement="1"> | |
<!-- Has a numbered asset! --> | |
<mt:for var="i" from="1" to="$num_assets" increment="1"> | |
<mt:AssetContainer placement="$i"> | |
<mt:SetVarBlock name="caption"><mt:AssetDescription encode_html="1"></mt:SetVarBlock> | |
<mt:AssetProperty property="image_width" setvar="this_width"> | |
<li<mt:If name="i" eq="1"> class="active"</mt:If>> | |
<img src="<mt:If name="this_width" gt="500"><mt:AssetThumbnailURL width="500"><mt:Else><mt:AssetURL></mt:If>" title="<mt:Var name="caption">" alt="<mt:Var name="caption">"> | |
</li> | |
</mt:AssetContainer> | |
</mt:for> | |
<MTElse> | |
<!-- Does not have a numbered asset! --> | |
<mt:EntryAssets tag="@gallery"> | |
<mt:SetVarBlock name="caption"><mt:AssetDescription encode_html="1"></mt:SetVarBlock> | |
<mt:AssetProperty property="image_width" setvar="this_width"> | |
<li<mt:If name="__first__"> class="active"</mt:If>> | |
<img src="<mt:If name="this_width" gt="500"><mt:AssetThumbnailURL width="500"><mt:Else><mt:AssetURL></mt:If>" title="<mt:Var name="caption">" alt="<mt:Var name="caption">"> | |
</li> | |
</mt:EntryAssets> | |
</MTIfHasAsset> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment