どのテンプレートを使用するかを指定するパラメータ
Wayfinderは最大で11種類のテンプレートを使用して、出力の様々な部分の構造を定義することができます。それに対応する一連のパラメータを通じて、それぞれを定義することができます。11種類のテンプレートのうち、2つだけが絶対に必要です。Wayfinderにはこれら2つのテンプレートのための内蔵デフォルトがあり、デフォルトで生成されるインデントされた順序なしリストを構築するために使用されます。また、&displayStartがTRUEに設定されている場合、3つ目のテンプレートが最小限必要なセットに加わり、Wayfinderにはそれに対する内蔵デフォルトもあります。
テンプレートを作成して使用するには:テンプレートをチャンクに入れ、適切なパラメータを使用してWayfinderにチャンクの名前を伝えます。11種類の可能なテンプレートそれぞれに対して1つのパラメータがあり、それらすべてを使用する場合は、11個の対応するチャンクが必要になります。
各テンプレートの内容は、いくつかのプレースホルダーが埋め込まれたHTMLの断片です。実行時に、Wayfinderはテンプレートのコピーを作成し、各プレースホルダーを動的に決定されたテキストで置き換え、その結果を生成している出力に追加します。このプロセスは、すべての部品が組み立てられるまで続けられ、その結果として生じる大量のテキストが出力となります。
親テンプレートは、それらの下に子行が出力される場合にのみ使用されることに注意してください。
テンプレートの出力がどのように組み合わされて完成品になるかを知るには、以下のテンプレートセクションを参照してください。
Parameter | Description | Value Type | Legal Values | Default Value | Comments |
---|---|---|---|---|---|
These are the row-level templates: (1) | |||||
&startItemTpl |
|
text string | The name of the chunk that contains the corresponding template. (See note (6) for additional options.) | (2) | There can be at most one instance of output from this template per Wayfinder Call. |
&rowTpl | This is the default template used for all row-level items except the start item. | " | " | (3) | |
&innerRowTpl |
|
" | " | (empty) | |
&hereTpl | This template will be used for the row corresponding to the current document, and its parent, and its grandparent, etc. all way up to the level just below the starting document. This allows you to apply a distinctive set of style rules to the chain of documents that leads from the top of the menu structure down to the current document -- no matter how many levels deep it might be. Note that these are the same documents that would be listed in a breadcrumb trail. | " | " | (empty) | |
&innerHereTpl | Same as for &hereTpl, except applies to all submenus. If this template is defined, then the &hereTpl template will only be used for the highest level of the menu hierarchy. If this template is not defined, then the &hereTpl template will be used for all rows. | " | " | (empty) | |
&parentRowTpl | If defined, then this template will define the output for rows that are parents. | " | " | (empty) | (7) |
&parentRowHereTpl | If defined, then this template will define the output of all rows in the "here" chain that are above the last/lowest level (i.e. for all the parents). | " | " | (empty) | (7) |
&activeParentRowTpl | ??? | " | " | (empty) | (7) |
&categoryFoldersTpl | If defined, then this template will define the output for rows that (a) are parents, and that (b) have no associated document template or (c) have their link attributes fields set to rel="category". This is useful because sometimes web designers use "empty" parents to provide category header information for a set of subsidiary pages, and you don't want active links to these header pages that have no web page template. |
" | " | (empty) | (7)? |
These are the row-level templates: (5) | |||||
&outerTpl |
|
" | " | (4) | |
&innerTpl |
|
" | " | (empty) |
Notes:
- All row-level templates can use any or all of these placeholders:
- [+wf.wrapper+] -- Tells Wayfinder where to insert the rows that comprise a menu or sub-menu, if any.
- [+wf.classnames+] -- A list of applicable CSS classnames, if any.
- [+wf.classes+] -- Contains
class="[+wf.classnames+]"
- [+wf.link+] -- The URL of the document.
- [+wf.title+] -- The pagetitle field of the document.
- [+wf.linktext+] -- The menutitle field of the document.
- [+wf.subitemcount+] -- The number of immediate children of the document.
- [+template_variable_name+] -- The name of any available template variable.
- [+document_field_name+] -- The name of any standard document field.
- [+wf.attributes+] -- The link attributes field of the document.
- [+wf.id+] -- The unique row ID (if any) specified by &rowIdPrefix.
- [+wf.docid+] -- The document's ID.
- [+wf.description+] -- The description field of the document.
- [+wf.introtext+] -- The introtext field of the document.
- The default &startItemTpl template is:
<h2>[+wf.linktext+]</h2>[+wf.wrapper+]
- The default &rowTpltemplate is:
<li [+wf.id+] [+wf.classes+] >
<a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
[+wf.wrapper+]
</li> - The default &outerTpltemplate is:
<ul [+wf.classes+]>
[+wf.wrapper+]
</ul> - I think that the only placeholder applicable to the &outerTpl and &innerTpltemplates are:
- [+wf.wrapper+] -- The output of all the row-level templates is placed in this placeholder.
- [+wf.classes+] -- A list of applicable CSS classnames, if any.
- [+wf.classnames+] -- Contains
class="[+wf.classnames+]"
- In addition to the "standard" option of specifying a chunk name as the value of a template parameter, there are two additional options:
- If a template parameter's value begins with @FILE: then Wayfinder will interpret the rest of the value as the directory path to a file which contains the template. For example:
&rowTpl= `@FILE:/assets/templates/myTemplate.txt`
- If a template parameter's value begins with @CODE: then Wayfinder will interpret the rest of the value as the template itself! For example:
&rowTpl= `@CODE:<h2>[+pagetitle+]</h2>`
- If a template parameter's value begins with @FILE: then Wayfinder will interpret the rest of the value as the directory path to a file which contains the template. For example:
- The parent templates are only used for parents that have child documents shown in a sub-menu.