重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

【GOLF me!】初月無料お試し

MT4のファイルオプション画面のカスタマイズについて質問です。
画像をアップロードする際にデフォルトでサムネイルの幅を固定することができたのですが、その設定をブログのIDごとに分岐したいのです。
イメージとしては、
【mt/tmpl/cms/dialog/asset_options_image.tmpl 内】----------------
<mt:if ブログのID="1">
<mt:if name="do_thumb">
<mtapp:setting
id="create_thumbnail"
label="<__trans phrase="Use thumbnail">"
label_class="no-header"
hint=""
show_hint="0"
help_page="file_upload"
help_section="creating_thumbnails">
<input type="checkbox" name="thumb" value="1" checked="checked" />
<label for="create_thumbnail"><__trans phrase="Use thumbnail"></label>
(<label for="thumb_width"><__trans phrase="width:"></label>
<input name="thumb_width" id="thumb_width" value="200" disabled onkeypress="widthKeyPress(event)" onchange="adjustWidthHeight(this.form, 1)" size="4" /> <__trans phrase="pixels">)
<input type="hidden" name="thumb_height" value="<mt:var name="thumb_height">" />
<img onload="checkThumbs('now');" src="<mt:var name="static_uri">images/spacer.gif" alt="" width="1" height="1" />
</mtapp:setting>
</mt:if>
</mt:if>

<mt:if ブログのID="2">
<mt:if name="do_thumb">
<mtapp:setting
id="create_thumbnail"
label="<__trans phrase="Use thumbnail">"
label_class="no-header"
hint=""
show_hint="0"
help_page="file_upload"
help_section="creating_thumbnails">
<input type="checkbox" name="thumb" value="1" checked="checked" />
<label for="create_thumbnail"><__trans phrase="Use thumbnail"></label>
(<label for="thumb_width"><__trans phrase="width:"></label>
<input name="thumb_width" id="thumb_width" value="400" disabled onkeypress="widthKeyPress(event)" onchange="adjustWidthHeight(this.form, 1)" size="4" /> <__trans phrase="pixels">)
<input type="hidden" name="thumb_height" value="<mt:var name="thumb_height">" />
<img onload="checkThumbs('now');" src="<mt:var name="static_uri">images/spacer.gif" alt="" width="1" height="1" />
</mtapp:setting>
</mt:if>
</mt:if>
--------------------------------------------------------------------
のような感じで、ブログ1にはサムネイルの幅200、ブログ2にはサムネイルの幅400と分岐して指定したいのです。
tmplファイルでのブログID条件分岐がどうしても分らなかったので質問させていただきました。

是非御回答よろしくお願いします!

A 回答 (1件)

MTBlogID


http://www.movabletype.jp/documentation/appendic …

MTSetVarBlock
http://www.movabletype.jp/documentation/appendic …

MTIf と eq モディファイア
http://www.movabletype.jp/documentation/appendic …

上記のタグを使えばできるはずです。質問から、ある程度テンプレートを理解されている方かと判断できますので、要点だけ。

<mt:SetVarBlock name="blog_id"><mt:BlogID></mt:SetVarBlock>
<mt:If name="blog_id" eq="1">
value="400"
<mt:ElseIf eq="2">
value="200"
</mt:If>

テンプレート全体を囲わず、変化させる必要のあるところだけ条件分けすれば楽だと思います。
    • good
    • 0
この回答へのお礼

回答ありがとうございます!!
プラグインやタグを駆使しなんとか思ったようにカスタマイズできはしたのですが、こんなスマートなやり方があったとは。。。。
早速使わせていただきます!

本当にありがとうございました!!

お礼日時:2009/02/23 22:50

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!