#author("2023-12-23T23:44:10+09:00","default:nemusg.pad","nemusg.pad") #author("2025-08-25T00:36:26+09:00;2023-12-23T23:44:10+09:00","default:nemusg.pad","nemusg.pad") * MT上での変数 [#a6998393] ** 注意点 [#g3e56244] - 変数には_(アンダースコア)は使用できるが、-(ハイフン・マイナス)は使用できない。 -- $ を利用したモディファイアを正常に評価できないため [[参考:https://movabletype.net/dict/var-13/setvar-1.html]] -- 算術記号のため誤動作する ** 変数を値をセットする [#r43c0cbb] *** mt:SetVar [#t5722863] #code_x{{ <mt:SetVar name="hensuu1" value="10"> }} *** mt:SetVarBlock [#a425f653] MTタグを代入できる等、一番自由度が高い。 改行も代入されるので、それが都合が悪い場合は `strip_linefeeds="1"` をつける。 #code_x{{ <mt:SetVarBlock name="hensuu2"><mt:EntryTitle></mt:SetVarBlock> }} *** setverモディファイア [#y4af096f] SetVarBlockより記述がシンプルになる場合がある #code_x{{ <mt:EntryTitle setver="hensuu3"> }} ** 変数から値を呼び出す [#dda5386b] *** mt:Var (mt:GetVar) [#m6c32475] #code_x{{ <mt:Var name="hensuu1"> }} *** モディファイア上で利用する [#xba9b76f] #code_x{{ <mt:Entries limit="$hensuu2"></mt:Entries> }} ** 予約変数 [#zf652fb9] あらかじめ決まっている変数 - [[アーカイブテンプレートに設定される予約変数 | Movable Type ドキュメントサイト:https://www.movabletype.jp/documentation/designer/archive-template-variable.html]] - [[ブロックタグに利用できる予約変数 | Movable Type ドキュメントサイト:https://www.movabletype.jp/documentation/mt6/design/templates/loopvariable.html]] #include(parts/feedback,notitle)