Skip to content

Instantly share code, notes, and snippets.

@tinybeans
tinybeans / gist:2391064
Created April 15, 2012 08:38
2階層目まではindex.htmlでそれ以降はlist_<MTCategoryBasename>.htmlにするアーカイブマッピング
<$MTSetVar name="nest_count" value="0"$><MTParentCategories><$MTSetVar name="nest_count" op="++"$></MTParentCategories><MTIf name="nest_count" gt="2">service/list_<$MTCategoryBasename$>.html<MTElse>_index.html</MTElse></MTIf>
@tinybeans
tinybeans / MTAppFieldSort
Created February 26, 2012 16:25
PowerCMS環境で、$.MTAppFieldSort()にtextを指定するとWYSWIGエディタがおかしくなるときの暫定対処法
次のように書きたいとする。
$.MTAppFieldSort({sort: 'title,excerpt,text,ext-field,keywords,tags'});
【対処方法】
text-fieldの手前を$.MTAppFieldSort()でソートして、後はtext-fieldにafter()していく。
(1) シンプルに書く
$.MTAppFieldSort({sort: 'title,excerpt'});
@tinybeans
tinybeans / MTAppInCats()はフォルダでも使える?
Created November 29, 2011 02:48
MTAppInCats()はウェブページの編集画面でも使えます。つまりフォルダごとに動作を変更することができます。
if (mtappVars.screen_id === 'edit-page') {
$.MTAppInCats({
categories: '3', // ←フォルダIDをカンマ区切りで設定
code: function(){
alert('Have a good day!'); // 処理内容を指定($.MTAppCustomize()などなど)
}
});
}
@tinybeans
tinybeans / gist:1221319
Created September 16, 2011 06:06
ランダムにバナーを表示する(mt:DynamicMTML + mt:CampaignRondom)
<mt:DynamicMTML>
<mt:CampaignRandom tag="main_visual">
<mt:CampaignAsset>
<p class="image"><img src="<$mt:AssetURL$>" alt="<$mt:AssetLabel$>" width="<$mt:AssetProperty property="image_width"$>" height="<$mt:AssetProperty property="image_height"$>" /></p>
</mt:CampaignAsset>
</mt:CampaignRandom>
</mt:DynamicMTML>
【設定ファイル】
[product_image]
fieldname = 商品画像
type = imagefield
class = post page
【テンプレート】
<?php
$imagefield = get_imagefield('product_image');
$image_id = $imagefield['id'];