どのテンプレートを使用するかを指定するパラメータ

Wayfinderは最大で11種類のテンプレートを使用して、出力の様々な部分の構造を定義することができます。それに対応する一連のパラメータを通じて、それぞれを定義することができます。11種類のテンプレートのうち、2つだけが絶対に必要です。Wayfinderにはこれら2つのテンプレートのための内蔵デフォルトがあり、デフォルトで生成されるインデントされた順序なしリストを構築するために使用されます。また、&displayStartがTRUEに設定されている場合、3つ目のテンプレートが最小限必要なセットに加わり、Wayfinderにはそれに対する内蔵デフォルトもあります。

テンプレートを作成して使用するには:テンプレートをチャンクに入れ、適切なパラメータを使用してWayfinderにチャンクの名前を伝えます。11種類の可能なテンプレートそれぞれに対して1つのパラメータがあり、それらすべてを使用する場合は、11個の対応するチャンクが必要になります。

各テンプレートの内容は、いくつかのプレースホルダーが埋め込まれたHTMLの断片です。実行時に、Wayfinderはテンプレートのコピーを作成し、各プレースホルダーを動的に決定されたテキストで置き換え、その結果を生成している出力に追加します。このプロセスは、すべての部品が組み立てられるまで続けられ、その結果として生じる大量のテキストが出力となります。

親テンプレートは、それらの下に子行が出力される場合にのみ使用されることに注意してください。

テンプレートの出力がどのように組み合わされて完成品になるかを知るには、以下のテンプレートセクションを参照してください。

ParameterDescriptionValue TypeLegal ValuesDefault ValueComments
These are the row-level templates: (1)
&startItemTpl
  • If the &displayStart parameter is set to TRUE, then Wayfinder will need a template for displaying information from the starting document. Wayfinder has a default template built in (as shown below), but you can optionally create your own.
  • Note that, if &displayStart parameter is set to TRUE, then Wayfinder will place the output of &outerTpl (which contains the entire menu structure!) into the [+wf.wrapper+] placeholder of the &startItemTpl, so be sure to include this placeholder in your custom template!
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
  • If specified, then this will be used as the generic template for every row shown in every sub-menu.
  • If not specified then &rowTpl will be used. [I assume that all the foregoing is true regardless of whether &innerTpl is specified?]
  • Even if specified, this template will be overriden by other row-level templates where appropriate.
" " (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
  • The &outerTpl template is one of the two templates that are always required. This template provides the outer "container" for the rows that comprise the menu -- which are all placed in this template's [+wf.wrapper+] placeholder (so don't forget to include it).
  • Wayfind has a built in template that it uses to construct its default, unordered list output.
  • If you do not define an &innerTpl, then the &outerTpl will be used wherever the &innerTpl would otherwise be used.
  • Remember that the &innerTpl and row-level templates nest inside this template, so make sure that you've designed your &outerTpl, &innerTpl, and row-level templates to work together to create correct HTML when they nest inside each other.
" " (4)  
&innerTpl
  • If a given document has children, and if those children are to appear in the output, then a sub-menu must be created for them below the parent document. The &innerTpl is used as the "container" for the rows in this sub-menu.
  • If the &innerTpl is specified, then it it used for all the sub-menus in Wayfinder's output, no matter how deeply nested, and the &outerTpl is used only for the highest level of the menu structure.
  • On the other hand, if the &innerTpl is not specified then the &outerTpl will be used as the container for all levels of the menu structure.
" " (empty)  

Notes:

  1. 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.
  2. The default &startItemTpl template is:
    <h2>[+wf.linktext+]</h2>[+wf.wrapper+]
  3. The default &rowTpltemplate is:
    <li [+wf.id+] [+wf.classes+] >
    <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
    [+wf.wrapper+]
    </li>
  4. The default &outerTpltemplate is:
    <ul [+wf.classes+]>
    [+wf.wrapper+]
    </ul>
  5. 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+]"
  6. 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>`
  7. The parent templates are only used for parents that have child documents shown in a sub-menu.

PR

  • KAGOYA
  • ASP at AKIHABARA Japan
  • CMS AWARDS 2007 Winner
ページトップへ