.. include:: /Includes.rst.txt
.. index:: Functions; tags
.. _tags:
====
tags
====
Used to create custom tags and define how they should be parsed. This
is used in conjunction with :ref:`parseFunc`.
The best known is the "link" tag, which is used to create links.
.. contents::
:local:
.. index:: tags; Properties
.. _tags-properties:
Properties
==========
.. _tags-array-of-strings:
*(array of strings)*
--------------------
:aspect:`Property`
*(array of strings)*
:aspect:`Data type`
:ref:`data-type-cobject`
:aspect:`Description`
Every entry in the array of strings corresponds to a tag, that will
be parsed. The elements **must** be in lowercase.
Every entry must be set to a content object.
:typoscript:`current` is set to the content of the tag, eg :html:`content`:
here :typoscript:`current` is set to :typoscript:`content`. It can be used with
:typoscript:`stdWrap.current = 1`.
**Parameters:**
Parameters of the tag are set in :php:`$cObj->parameters` (key is lowercased):
.. code-block:: html
content
This sets :php:`$cObj->parameters['color'] = 'red'`.
:php:`$cObj->parameters['allParams']` is automatically set to the whole
parameter-string of the tag. Here it is :html:`color="red"`
**Special properties for each content object:**
**[cObject].stripNL:** :ref:`data-type-boolean` option, which tells :typoscript:`parseFunc` that
newlines before and after the content of the tag should be stripped.
**[cObject].breakoutTypoTagContent:** :ref:`data-type-boolean` option, which tells
:ref:`parseFunc` that this block of content is breaking up the nonTypoTag
content and that the content after this must be re-wrapped.
:aspect:`Examples`
.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
tags.bold = TEXT
tags.bold {
stdWrap.current = 1
stdWrap.wrap =
|
}
tags.bold.stdWrap.stripNL = 1
This example would e.g. transform :html:`Important!`
to :html:`
Important!
`.
.. _tags-examples:
Example
=======
This example creates 4 custom tags. The :html:``-, :html:``-,
:html:``- and :html:``-tags:
:html:`` is made into a typolink and provides an easy way of creating
links in text.
:html:`` is used to create bullet-lists.
:html:`` will create an image file with 90x10 pixels where the text is
the content of the tag.
:html:`` lets us place an image in the text. The content of the tag
should be the image-reference in :file:`fileadmin/images/`.
.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
tags {
link = TEXT
link {
stdWrap.current = 1
stdWrap.typolink.extTarget = _blank
stdWrap.typolink.target = {$cLinkTagTarget}
stdWrap.typolink.wrap =