コミュニティセントラル
探索
メインページ
ディスカッション
全ページ
コミュニティ
インタラクティブな地図
最近のブログの投稿
最新情報
Fandomブログ
ヒントとコツ
コミュニティブログ
技術情報
コミュニティ
Fandomについて
Fandomを選ぶこと
コミュニティのガイドライン
スタッフ
管理者
SOAP
フォーラム
まずはここから聞いてみよう
技術的ヘルプ
デザインヘルプ
コミュニティ管理
ディスカッション全般
旧フォーラムのアーカイブ
雑談・告知
不具合・要望
ヘルプ・相談
コミュニティ・ポータル
ヘルプ
ヘルプページ
始めよう
投稿する
あなたのコミュニティの管理
技術をもっと磨く
あなたのコミュニティのデザイン
モバイル
すべてのトピックをチェック
Discord
リクエスト
ディスカッション・モデレーターサポート
お問い合わせ
活動停止中のコミュニティの管理者権限
アカウント名の変更
スタッフへのお問い合わせ
バグ・不具合の報告
ブロックに関するお問い合わせ
ウィキクリーンナップ
プロフィール違反を報告
スパムを報告
荒らしを報告
違反を報告
スパムフィルターの問題
プロモーション&デザイン
スポットライト
AWBボットスキャン (英語)
インターウィキ/言語間リンク
FANDOM
ゲーム
映画
テレビ
Wiki
Wikiを探索
コミュニティセントラル
Wikiを はじめよう
アカウントをお持ちでない場合
登録
ログイン
ログイン
登録
コミュニティセントラル
415
ページ
探索
メインページ
ディスカッション
全ページ
コミュニティ
インタラクティブな地図
最近のブログの投稿
最新情報
Fandomブログ
ヒントとコツ
コミュニティブログ
技術情報
コミュニティ
Fandomについて
Fandomを選ぶこと
コミュニティのガイドライン
スタッフ
管理者
SOAP
フォーラム
まずはここから聞いてみよう
技術的ヘルプ
デザインヘルプ
コミュニティ管理
ディスカッション全般
旧フォーラムのアーカイブ
雑談・告知
不具合・要望
ヘルプ・相談
コミュニティ・ポータル
ヘルプ
ヘルプページ
始めよう
投稿する
あなたのコミュニティの管理
技術をもっと磨く
あなたのコミュニティのデザイン
モバイル
すべてのトピックをチェック
Discord
リクエスト
ディスカッション・モデレーターサポート
お問い合わせ
活動停止中のコミュニティの管理者権限
アカウント名の変更
スタッフへのお問い合わせ
バグ・不具合の報告
ブロックに関するお問い合わせ
ウィキクリーンナップ
プロフィール違反を報告
スパムを報告
荒らしを報告
違反を報告
スパムフィルターの問題
プロモーション&デザイン
スポットライト
AWBボットスキャン (英語)
インターウィキ/言語間リンク
「
ヘルプ:テンプレート/作成
」を編集中
ページに戻る
編集
ソースを編集
履歴表示
トーク(0件)
ページの編集
ヘルプ:テンプレート/作成
警告:
ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。
ログイン
または
アカウントを作成
すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。
中間の版での編集と競合したため、取り消せませんでした。
スパム攻撃防止用のチェックです。 けっして、ここには、値の入力は
しない
でください!
{{Tocright}} このページでは、'''[[ヘルプ:テンプレート|テンプレート]]'''の作成方法ときまりを説明します。テンプレートの編集には、[[ヘルプ:ウィキテキスト|ウィキコード]]を使用します。作成したいテンプレートに応じて、[[ヘルプ:テーブル/ウィキテキスト|テーブルの構文]]、[[ヘルプ:カテゴリ|カテゴリ]]、[[ヘルプ:マジックワード|マジックワード]]、[[ヘルプ:ページのフォーマット/ウィキテキスト/CSS|インラインCSS]]等のウィキテキストが使用できる必要があります。 == 基本 == 新しいテンプレートを作成するときは、[[ヘルプ:新規ページ|新規ページ]]を"テンプレート" (Template) [[ヘルプ:名前空間|名前空間]]に作り、ページ名が<code>テンプレート:<テンプレート名></code> (<code>template:<テンプレート名></code>) となるようにします。テンプレート名前空間のテンプレートは、挿入する際に、名前空間を省略して<code><nowiki>{{テンプレート名}}</nowiki></code>と記述するだけで呼び出すことができます。 == 簡単なテンプレートを作成する == 簡単なテンプレートの例として、ナビゲーションバーのテンプレートを作ってみましょう。ナビゲーションバーとは、2,3件の[[ヘルプ:リンク/ウィキテキスト|リンク]]を含む箱です。この箱は、divタグを[[ヘルプ:ページのフォーマット/ウィキテキスト/CSS|インラインCSS]]で装飾して作成しています。(<code><nowiki><div style="…">___</div></nowiki></code>) ;例 : <code><nowiki><div style="width:100%; border:thick double orange; background-color: gold; color:marine; margin:2em; padding:1ex; text-align:center;">[[ヘルプ:テンプレート|]] – [[ヘルプ:テンプレート/ウィキテキスト|ウィキテキスト]] – [[ヘルプ:テンプレートの置換|置換]] – [[ヘルプ:テンプレート/作成|作成]]</div></nowiki></code> 結果 <div style="width:100%; border:thick double orange; background-color: gold; color:marine; margin:2em; padding:1ex; text-align:center;">[[ヘルプ:テンプレート|テンプレート]] – [[ヘルプ:テンプレート/ウィキテキスト|ウィキテキスト]] – [[ヘルプ:テンプレートの置換|置換]] – [[ヘルプ:テンプレート/作成|作成]]</div> == テンプレートとカテゴリ == {{Anchor|noinclude}}{{Anchor|includeonly}}{{Anchor|onlyinclude}} {| class="wikitable" style="float:right; margin:1ex;" ! noinclude | 他のページから呼び出したときに取り除く |- ! onlyinclude | 呼び出された時の表示部分を指定する |- | colspan="2" | |- ! includeonly | テンプレートを直接表示した時は無視する |} テンプレートページを[[ヘルプ:カテゴリ|カテゴリ]]に追加するとき、そのまま追加すると、テンプレートを呼び出している全ページに反映されてしまいます。 これを防ぐためには、カテゴリへのリンクを<code><nowiki><noinclude>___</noinclude></nowiki></code>タグで囲みます。そうすることで、元のテンプレートページには表示されますが、テンプレートの呼び出し先ページでは表示されません。また、このタグを使うことで、テンプレートの説明をテンプレートページに加えることもできます。記述例:<code><nowiki><noinclude>[[カテゴリ:User Templates]]</noinclude></nowiki></code> または、<code><nowiki><noinclude>___</noinclude></nowiki></code>タグで囲むことで、呼び出し先ページで表示させたい部分を指定することもできます。これらのタグで囲んだ部分は、元の(テンプレート)ページでも表示されます。 呼び出し先ページでのみ表示させたい部分は、<code><nowiki><includeonly>___</includeonly></nowiki></code>タグで囲みます。カテゴリへのリンクを記述する際に使用すると、テンプレート自身をカテゴリに加えることなく、このテンプレートを使用しているページのみを指定したカテゴリに含めることができます。 <!-- == パラメータ(引数) == A ''named'' [[ヘルプ:テンプレートパラメータ|]] is written his name in triple braces on the submission page. ''Unnamed'' parameters with ''1'' starting on their ''order in the original call'' also written numbered in the triple clamps. When calling the template text with which the parameter is passed appears in place of the parameter. If a parameter is passed no value, then the parameter syntax appears in the template call. === パラメータの例 === 以下の内容の ''テンプレート:テンプレート'' というテンプレートを例にして説明します。 <pre>{{{1}}}は{{{何}}}。</pre> {| class="article-table" style="max-width: 640px; margin: 1em auto;" ! 入力内容 !! 出力結果 |- | <code><nowiki>{{テンプレート}}</nowiki></code> || {{{1}}}は{{{何}}}。 |- | <code><nowiki>{{テンプレート|何=私には分かりません}}</nowiki></code> || {{{1}}}は私には分かりません。 |- | <code><nowiki>{{テンプレート|}}</nowiki></code> || は{{{何}}}。 |- | <code><nowiki>{{テンプレート||何=パラメータに''何も''指定されていません}}</nowiki></code> || はパラメータに''何も''指定されていません。 |- | <code><nowiki>{{テンプレート|1=何|何=}}</nowiki></code> || 何は。 |- | <code><nowiki>{{テンプレート|何=コツがいる|テンプレート作成}}</nowiki></code> || テンプレート作成はコツがいる。 |} === パラメータの既定値指定 === You can on the submission page parameters to assign a default value that is written to the parameter syntax behind the name, separated by a vertical line, for example, <code><nowiki>{{{1|指定無し}}}</nowiki></code> or <code><nowiki>{{{何|}}}</nowiki></code>. ==== 既定値指定したパラメータの例 ==== 以下の内容の ''テンプレート:テンプレート'' というテンプレートを例にして説明します。 <pre>{{{1|指定無し}}}は{{{何|}}}。</pre> <pre>{{{1}}}は{{{何}}}。</pre> {| class="article-table" style="max-width: 640px; margin: 1em auto;" ! 入力内容 !! 出力結果 |- | <code><nowiki>{{テンプレート}}</nowiki></code> || 指定無しは。 |- | <code><nowiki>{{テンプレート|何=私には分かりません}}</nowiki></code> || 指定無しは私には分かりません。 |- | <code><nowiki>{{テンプレート|}}</nowiki></code> || は。 |- | <code><nowiki>{{テンプレート||何=パラメータに''何も''指定されていません}}</nowiki></code> || はパラメータに''何も''指定されていません。 |- | <code><nowiki>{{テンプレート|1=何|何=}}</nowiki></code> || 何は。 |- | <code><nowiki>{{テンプレート|何=コツがいる|テンプレート作成}}</nowiki></code> || テンプレート作成はコツがいる。 |} In the example (3rd / 4th line) you can see that the substitute value is not shown if the parameter with nothing is called as value. This behavior can use the parser off "if". === パーサー関数 === Parser functions are a type of templates with unnamed parameters, before the first parameter is a colon and no vertical bar. Parser functions are very practical tools when creating templates. Only the allergängigsten functions are touched, the complete list is available at [[ヘルプ:Magic words#parser functions]]. [[ヘルプ:パーサー関数]] ==== if ==== ;構文 : <code><nowiki>{{#if:___|___}}</nowiki></code> oder <code><nowiki>{{#if:___|___|___}}</nowiki></code> This function checks whether the first parameter is empty (if not there is nothing there). If so, then the second parameter is output, otherwise either an optional third parameter value or nothing. With the If function to substitute values for template parameters can pretend to be displayed even if the parameter with nothing is passed. This looks like this: <pre>{{#if:{{{1|}}}|{{{1}}}|Keine Angabe}}</pre> In this example, the test value is a template parameter <u>with an empty substitute value</u>. There are three possible scenarios: # The template parameter is not called: Then the replacement value is read (the empty string) of the If function, and they are "not specified" back. # The template parameter can be called with an empty value. => "No Information" # As long as the template parameter is not passed yet, the if-function returns this parameter. ===== Conditional syntax use ===== :{{Anchor|Screen|Example ''Screen''}} For [[ヘルプ:テーブル/ウィキテキスト|tables]] as templates (Infobox) you want to set up an image parameter so that you enter only the file name instead of the entire image syntax policy. But that does not Wikitext fragments arise when an empty or no image parameter is passed, the entire image syntax is packed into the template page in an IF function: <pre>{{#if:{{{image parameters|}}}|[[File:{{{image parameters}}}]]}}</pre> :{{Anchor|Table extension by parameters|Example ''Table extension by parameters''}} For [[ヘルプ:テーブル/ウィキテキスト|tables]] as templates (Infobox), it is often desirable to have empty parameter passed also cause the elimination of the associated table row. So you put the complete line syntax in the If function: <pre> {{#if: {{{input|}}} | {{!}}- {{!}} Input: {{!}} {{{input}}} }} </pre> The example used in the [[テンプレート:!]] than content just a vertical line and is here instead of the same syntax used in the table, so that the if function does not get mixed up. In the example, a table row is inserted with two cells (a two-column line) with set parameters where the parameter value is to be read in the second cell. ==== ifeq ==== ;Calling : <code><nowiki>{{#ifeq:___|___|___}}</nowiki></code> oder <code><nowiki>{{#ifeq:___|___|___|___}}</nowiki></code> This function checks the first parameter not emptiness, but on par with the second parameter. If they are identical, the third parameter is output, otherwise an optional fourth parameter, or simply nothing. ==== switch ==== ;Calling <pre>{{#switch: ___ | ___ = ___ | ___ | ___ = ___ | ___ = ___ | … | ___ }}</pre> This feature is a continuation of ifeq: It checks the first parameter for equality with the front part of the second parameter. If they are identical, the rear part is output, otherwise you continue with the next parameter. If a parameter only a single value, without "=", then it applies the output value after the next "=". Is optional in the last parameter, only one value, this is a standard output that is output at no hits. ==== Variable ==== As parameters for parser not only template parameter can be passed, but, for example, variables such as <code><nowiki>{{PAGENAME}}</nowiki></code> (the name of a wiki page). Variables in templates are based on the side, in which the template is called, <code><nowiki>{{PAGENAME}}</nowiki></code> would therefore spend the name of the page and not the template name. The list of variables is at [[ヘルプ:マジックワード#variable]]. --> == 関連情報 == * [[ヘルプ:テンプレート/レイアウト|テンプレートのレイアウト]] * [[ヘルプ:テンプレートパラメータ|テンプレートパラメータ]] * [[ヘルプ:パーサー関数|パーサー関数]] == その他のヘルプとフィードバック == {{Help and feedback section}} {{DEFAULTSORT:てんふれえと/さくせい}} [[de:Hilfe:Vorlagen/erstellen]] [[カテゴリ:ヘルプ]] [[カテゴリ:編集]]
編集内容の要約:
コミュニティセントラルへの投稿はすべて、「CC-BY-SA」に従って公開されるものとしてみなされます
キャンセル
編集の仕方
(新しいウィンドウで開きます)
このページで使用されているテンプレート:
テンプレート:Anchor
(
ソースを閲覧
)
テンプレート:Help and feedback section
(
ソースを閲覧
)
テンプレート:Tocright
(
ソースを閲覧
)
Follow on IG
TikTok
Join Fan Lab