Placeholders YAMS
YAMS Placeholders
Están disponibles dos formas para cada placeholder. En la primera forma, (yams_?), los placeholders dan información acerca del documento actual. En la segunda forma, (yams_?:docId), dan información acercad del documento con el identificador de documento dado, docId. Debe de ser posible usar llamados a snippets y chunks para especificar el identificador de documento. (yams_doc:[id]) puede ser usado dentro de plantillas.
Debe de ser posible usar YAMS placeholders casi en cualquier lugar, inclusive en chunks, en los nombres y salida de las template variables y en los nombres, salida y parámetros de los llamados de snippet.
Cuando la salida de un placeholder de YAMS es dependiente de un idioma necesita saber cual es el idioma actual. El idioma actual es dependiente del contexto. El bloque (yams-in) o el (yams-repeat) permiten la inclusión de contenido en idioma alternativo en una página. (Ver la pestaña Constructores). Si un placeholder cae dentro de uno de estos bloques, entonces el idioma actual es el especificado por estos bloques. De tora manera el idioma actual es tomado a ser el idioma en el cual la página actual está siendo mostrada. Puede haber ocasiones cuando sea necesario anular este comportamiento y forzar al placeholder a tratar el idioma del documento actual como el idioma actual. Esto puede ser llevado acabo añadiendo el símbolo + al final del nombre del placeholder. Por ejemplo, lo siguiente generará un bloque (yams-repeat) que mostrará una lista de nombres de los idiomas disponibles, todos escritos en el idioma del documento actual:
<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_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 MODx language name for the default language | The MODx 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 fieldnameis 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. |
Same as for monolingual documents |
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).