Placeholders

This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.

Two forms of each placeholder are available. In the first form, (yams_???), the placeholders provide information about the current document. In the second form, (yams_???:docId), they provide information about the document with the given document identifier, docId.

It should be possible to use snippet calls and chunks to specify the document identifier. (yams_doc:[+id+]) can be used within templates.

It should be possible to use YAMS placeholders almost anywhere, including in chunks, in the names and output of template variables, and in the names, output and parameters of snippet calls.

When the output of a YAMS placeholder is language dependent it needs to know what the current language is. The current language is dependent upon the context. The (yams-in) or (yams-repeat) blocks allow the inclusion of alternate language content on a page. (See the Constructs tab).

If a placeholder falls within either of these blocks, then the current language is that specified by those blocks. Otherwise the current language is taken to be the language in which the current page is being displayed. There may be occasions when it is necessary to override this behaviour and force the placeholder to treat the current document language as the current language.

This can be achieved by appending a + symbol to the end of the name of the placeholder. For example, the following will generate a (yams-repeat) block that will display a list of the names of the available languages, all written in the current document language:

<ul>[[YAMS? &get=`repeat` &repeattpl=`@CODE:<li>(yams_name_in_(yams_id+))</li>`]]</ul>

YAMS placeholders

Placeholder Monolingual Document Multilingual Document
(yams_id)
(yams_id:docId)
The default language id The current language id
(yams_defaultid)
(yams_defaultid:docId)
The default language id
This is planned for inclusion in YAMS 1.2
The default language id
This is planned for inclusion in YAMS 1.2
(yams_tag)
(yams_tag:docId)
The primary language tag for the default language The primary language tag for the current language
(yams_root)
(yams_root:docId)
Nothing If specified and non-empty, the server root name for the current language, else nothing
(yams_/root)
(yams_/root:docId)
Nothing If specified and non-empty, the server root name for the current language preceded by a /, else nothing
(yams_root/)
(yams_root/:docId)
Nothing If specified and non-empty, the server root name for the current language followed by a /, else nothing
(yams_site)
(yams_site:docId)
If server name mode is ON, an URL created using the specified monolingual server name. If server name mode is OFF, the same output as [(site_url)]. The full multilingual site url including server name and server root as required for the current page.
(yams_server)
(yams_server:docId)
Same as for yams_site. Same as for yams_site, but with no root name.
(yams_doc)
(yams_doc:docId)
A complete URL for the document or weblink. There is an option on the "Other Params" tab that will suppress the filename for the site start document. A complete URL for the current language version of the document or weblink. There is an option on the 'Other Params' tab that will suppress the filename for the site start document.
(yams_docr)
(yams_docr:docId)
Same as for yams_doc, but weblinks are resolved. Same as for yams_doc, but weblinks are resolved.
(yams_dir)
(yams_dir:docId)
The language direction ('ltr' or 'rtl') for the default language The language direction ('ltr' or 'rtl') for the current language
(yams_align)
(yams_align:docId)
The text alignment ('left' or 'right') for the default language The text alignment ('left' or 'right') for the current language
(yams_mname)
(yams_mname:docId)
The Evo language name for the default language The Evo language name for the current language
(yams_confirm)
(yams_confirm:docId)
The name of the Confirm Language param. (See the Other Params tab.) The name of the Confirm Language param. (See the Other Params tab.)
(yams_change)
(yams_change:docId)
The name of the Change Language param. (See the Other Params tab.) The name of the Change Language param. (See the Other Params tab.)
(yams_name)
(yams_name:docId)
The name of the default language in the default language The name of the current language in the current language
(yams_name_in_langId)
(yams_name_in_langId:docId)
The name of the default language, written in the language specified by the langId language group id. The name of the current language, written in the language specified by the langId language group id.
(yams_choose)
(yams_choose:docId)
The Select Language Text, written in the default language. (See the Language Settings tab.) The Select Language Text, written in the current language. (See the Language Settings tab.)
((yams_data:docId:fieldname))
((yams_data:docId:fieldname:phx))
This special inline placeholder is different from all the others. It is used by YAMS for efficiently grabbing template variables from documents. Here, docId is the id of the document to grab the template variable from and fieldname is the name of the template variable from which to get the data. In future, this syntax will allow phx to be used, but this is not currently supported.

YAMS will search out all these placeholders in the document, work out what information needs to be grabbed from the database and grab in large chunks so as to minimise the number of database queries required.

The [[YAMS? &get=`data` snippet call (same as the legacy [[YAMS? &get=`content` snippet call) which is used in the Wayfinder templates and internally by the YAMS Ditto extension will now output such placeholders meaning improved performance for large Ditto and Wayfinder calls.

As of YAMS 1.2 this will work with document variables as well as template variables.

Same as for monolingual documents
(yams_multi)
(yams_multi:docId)
Outputs 0. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type. Outputs 1. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type.
(yams_mono)
(yams_mono:docId)
Outputs 1. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type. Outputs 0. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type.
(yams_type)
(yams_type:docId)
Outputs mono. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type. Outputs multi. This parameter is due to appear in YAMS 1.2, and can be used in combination with PHx, for example, to exclude or include content based on type.

Suggest an edit to this page.