diff --git a/Documentation/Functions/Stdwrap.rst b/Documentation/Functions/Stdwrap.rst index 89567126..fcc3114b 100644 --- a/Documentation/Functions/Stdwrap.rst +++ b/Documentation/Functions/Stdwrap.rst @@ -64,186 +64,159 @@ Properties Properties for getting data ---------------------------- -.. _stdwrap-setContentToCurrent: +.. confval-menu:: + :name: stdwrap-get + :display: table + :type: -setContentToCurrent -~~~~~~~~~~~~~~~~~~~ + .. _stdwrap-setContentToCurrent: -.. confval:: setContentToCurrent - :name: stdwrap-setContentToCurrent - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + .. confval:: setContentToCurrent + :name: stdwrap-setContentToCurrent + :type: :ref:`data-type-boolean` / :ref:`stdWrap` - Sets the current value to the incoming content of the function. + Sets the current value to the incoming content of the function. -.. _stdwrap-addpagecachetags: + .. _stdwrap-addpagecachetags: -addPageCacheTags -~~~~~~~~~~~~~~~~ + .. confval:: addPageCacheTags + :name: stdwrap-addpagecachetags + :type: :ref:`data-type-string` / :ref:`stdWrap` -.. confval:: addPageCacheTags - :name: stdwrap-addpagecachetags - :type: :ref:`data-type-string` / :ref:`stdWrap` + Comma-separated list of cache tags, which should be added to the page + cache. - Comma-separated list of cache tags, which should be added to the page - cache. + .. rubric:: Examples - .. rubric:: Examples + .. code-block:: typoscript - .. code-block:: typoscript + addPageCacheTags = pagetag1,pagetag2,pagetag3 - addPageCacheTags = pagetag1,pagetag2,pagetag3 + This will add the tags "pagetag1", "pagetag2" and "pagetag3" to the + according cached pages in cache_pages. - This will add the tags "pagetag1", "pagetag2" and "pagetag3" to the - according cached pages in cache_pages. + Pages, which have been cached with a tag, can be deleted from cache + again with the TSconfig option + :ref:`TCEMAIN.clearCacheCmd `. - Pages, which have been cached with a tag, can be deleted from cache - again with the TSconfig option - :ref:`TCEMAIN.clearCacheCmd `. + .. note:: + If you instead want to store rendered content into the + caching framework, see the stdWrap feature :ref:`stdwrap-cache`. - .. note:: - If you instead want to store rendered content into the - caching framework, see the stdWrap feature :ref:`stdwrap-cache`. + .. _stdwrap-setCurrent: -.. _stdwrap-setCurrent: + .. confval:: setCurrent + :name: stdwrap-setCurrent + :type: :ref:`data-type-string` / :ref:`stdWrap` -setCurrent -~~~~~~~~~~ + Sets the "current"-value. This is normally set from some outside + routine, so be careful with this. But it might be handy to do this -.. confval:: setCurrent - :name: stdwrap-setCurrent - :type: :ref:`data-type-string` / :ref:`stdWrap` - Sets the "current"-value. This is normally set from some outside - routine, so be careful with this. But it might be handy to do this + .. _stdwrap-lang: + .. confval:: lang + :name: stdwrap-lang + :type: Array of language keys / :ref:`stdWrap` -.. _stdwrap-lang: + This is used to define optional language specific values based on the + :ref:`current site language `. -lang -~~~~ + .. rubric:: Examples -.. confval:: lang - :name: stdwrap-lang - :type: Array of language keys / :ref:`stdWrap` + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - This is used to define optional language specific values based on the - :ref:`current site language `. + page.10 = TEXT + page.10.value = I am a Berliner! + page.10.stdWrap.lang.de = Ich bin ein Berliner! - .. rubric:: Examples + Output will be "Ich bin..." instead of "I am..." - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - - page.10 = TEXT - page.10.value = I am a Berliner! - page.10.stdWrap.lang.de = Ich bin ein Berliner! - - Output will be "Ich bin..." instead of "I am..." + .. _stdwrap-data: + .. confval:: data + :name: stdwrap-data + :type: :ref:`data-type-gettext` / :ref:`stdWrap` -.. _stdwrap-data: + .. _stdwrap-field: -data -~~~~ + .. confval:: field + :name: stdwrap-field + :type: Field name / :ref:`stdWrap` -.. confval:: data - :name: stdwrap-data - :type: :ref:`data-type-gettext` / :ref:`stdWrap` + Sets the content to the value of the according field + (which comes from :php:`$cObj->data[*field*]`). + .. note:: + :php:`$cObj->data` changes depending on the context. + See the description for the data type ":ref:`data-type-gettext`"/field! -.. _stdwrap-field: + .. rubric:: Examples -field -~~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: field - :name: stdwrap-field - :type: Field name / :ref:`stdWrap` + page.10.field = title - Sets the content to the value of the according field - (which comes from :php:`$cObj->data[*field*]`). + This sets the content to the value of the field "title". - .. note:: - :php:`$cObj->data` changes depending on the context. - See the description for the data type ":ref:`data-type-gettext`"/field! + You can also check multiple field names, if you divide them + by "//". - .. rubric:: Examples - - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - - page.10.field = title - - This sets the content to the value of the field "title". - - You can also check multiple field names, if you divide them - by "//". - - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page.10.field = nav_title // title + page.10.field = nav_title // title - Here the content from the field nav\_title will be returned - unless it is a blank string. If a blank string, the value of - the title field is returned. + Here the content from the field nav\_title will be returned + unless it is a blank string. If a blank string, the value of + the title field is returned. -.. _stdwrap-current: + .. _stdwrap-current: -current -~~~~~~~ + .. confval:: current + :name: stdwrap-current + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -.. confval:: current - :name: stdwrap-current - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + Sets the content to the "current" value (see :ref:`->split `) - Sets the content to the "current" value (see :ref:`->split `) + .. _stdwrap-cObject: -.. _stdwrap-cObject: + .. confval:: cObject + :name: stdwrap-cObject + :type: :ref:`data-type-cobject` -cObject -~~~~~~~ + Loads content from a content object. -.. confval:: cObject - :name: stdwrap-cObject - :type: :ref:`data-type-cobject` - Loads content from a content object. + .. _stdwrap-numRows: + .. confval:: numRows + :name: stdwrap-numRows + :type: :ref:`->numRows ` / :ref:`stdWrap` -.. _stdwrap-numRows: + Returns the number of rows resulting from the supplied :sql:`SELECT` query. -numRows -~~~~~~~ -.. confval:: numRows - :name: stdwrap-numRows - :type: :ref:`->numRows ` / :ref:`stdWrap` + .. _stdwrap-preUserFunc: - Returns the number of rows resulting from the supplied :sql:`SELECT` query. + .. confval:: preUserFunc + :name: stdwrap-preUserFunc + :type: :ref:`data-type-function-name` + Calls the provided PHP function. If you specify the name with a '->' + in it, then it is interpreted as a call to a method in a class. -.. _stdwrap-preUserFunc: + Two parameters are sent to the PHP function: As first parameter a + content variable, which contains the current content. This is the + value to be processed. As second parameter any sub-properties of + preUserFunc are provided to the function. -preUserFunc -~~~~~~~~~~~ - -.. confval:: preUserFunc - :name: stdwrap-preUserFunc - :type: :ref:`data-type-function-name` - - Calls the provided PHP function. If you specify the name with a '->' - in it, then it is interpreted as a call to a method in a class. - - Two parameters are sent to the PHP function: As first parameter a - content variable, which contains the current content. This is the - value to be processed. As second parameter any sub-properties of - preUserFunc are provided to the function. - - See :ref:`stdwrap-postUserFunc`. + See :ref:`stdwrap-postUserFunc`. .. index:: Function stdWrap; Override and conditions @@ -252,1681 +225,1516 @@ preUserFunc Properties for overriding and conditions ---------------------------------------- -.. _stdwrap-override: - -override -~~~~~~~~ - -.. confval:: override +.. confval-menu:: :name: stdwrap-override - :type: :ref:`data-type-string` / :ref:`stdWrap` - - If `override` returns something else than "" or zero (trimmed), the - content is loaded with this! - - -.. _stdwrap-preIfEmptyListNum: - -preIfEmptyListNum -~~~~~~~~~~~~~~~~~ - -.. confval:: preIfEmptyListNum - :name: stdwrap-preIfEmptyListNum - :type: (as ":ref:`stdwrap-listNum`" below) - + :display: table + :type: -.. _stdwrap-ifNull: + .. _stdwrap-override: -ifNull -~~~~~~ + .. confval:: override + :name: stdwrap-override + :type: :ref:`data-type-string` / :ref:`stdWrap` -.. confval:: ifNull - :name: stdwrap-ifNull - :type: :ref:`data-type-string` / :ref:`stdWrap` + If `override` returns something else than "" or zero (trimmed), the + content is loaded with this! - If the content is null (:php:`NULL` type in PHP), the content is overridden - with the value defined here. - .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. _stdwrap-preIfEmptyListNum: - page.10 = COA_INT - page.10 { - 10 = TEXT - 10 { - stdWrap.field = description - stdWrap.ifNull = No description defined. - } - } + .. confval:: preIfEmptyListNum + :name: stdwrap-preIfEmptyListNum + :type: (as ":ref:`stdwrap-listNum`" below) - This example shows the content of the field description or, if that - field contains the value :php:`NULL`, the text "No description defined.". + .. _stdwrap-ifNull: -.. _stdwrap-ifEmpty: + .. confval:: ifNull + :name: stdwrap-ifNull + :type: :ref:`data-type-string` / :ref:`stdWrap` -ifEmpty -~~~~~~~ + If the content is null (:php:`NULL` type in PHP), the content is overridden + with the value defined here. -.. confval:: ifEmpty - :name: stdwrap-ifEmpty - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - If the trimmed content is empty at this point, the content is loaded - with :typoscript:`ifEmpty`. Zeros are treated as empty values! + page.10 = COA_INT + page.10 { + 10 = TEXT + 10 { + stdWrap.field = description + stdWrap.ifNull = No description defined. + } + } + This example shows the content of the field description or, if that + field contains the value :php:`NULL`, the text "No description defined.". -.. _stdwrap-ifBlank: -ifBlank -~~~~~~~ + .. _stdwrap-ifEmpty: -.. confval:: ifBlank - :name: stdwrap-ifBlank - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. confval:: ifEmpty + :name: stdwrap-ifEmpty + :type: :ref:`data-type-string` / :ref:`stdWrap` - Same as :typoscript:`ifEmpty` but the check is done against ''. Zeros are not - treated as blank values! + If the trimmed content is empty at this point, the content is loaded + with :typoscript:`ifEmpty`. Zeros are treated as empty values! -.. _stdwrap-listNum: + .. _stdwrap-ifBlank: -listNum -~~~~~~~ + .. confval:: ifBlank + :name: stdwrap-ifBlank + :type: :ref:`data-type-string` / :ref:`stdWrap` -.. confval:: listNum - :name: stdwrap-listNum - :type: :ref:`data-type-string` / :ref:`stdWrap` + Same as :typoscript:`ifEmpty` but the check is done against ''. Zeros are not + treated as blank values! - Explodes the current content :ref:`stdwrap-listNum-splitChar` - (Default: `,`) and returns the object specified by `listNum`. - Possible values: + .. _stdwrap-listNum: - :typoscript:`last` - The special keyword :typoscript:`last` is replaced with the index of - the last element in the exploded content. + .. confval:: listNum + :name: stdwrap-listNum + :type: :ref:`data-type-string` / :ref:`stdWrap` - :typoscript:`rand` - The special keyword :typoscript:`rand` is replaced with the index of - a random element in the exploded content. + Explodes the current content :ref:`stdwrap-listNum-splitChar` + (Default: `,`) and returns the object specified by `listNum`. - :ref:`calc` - After the special keywords are replaced with their according numeric - values the + Possible values: - 0 - last - If the content of `listNum` can be interpreted as integer the according - index of the exploded content is returned. Counting starts with 0. + :typoscript:`last` + The special keyword :typoscript:`last` is replaced with the index of + the last element in the exploded content. - .. rubric:: Examples + :typoscript:`rand` + The special keyword :typoscript:`rand` is replaced with the index of + a random element in the exploded content. - This would return "item 1": + :ref:`calc` + After the special keywords are replaced with their according numeric + values the - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + 0 - last + If the content of `listNum` can be interpreted as integer the according + index of the exploded content is returned. Counting starts with 0. - page.10 = TEXT - page.10.value = item 1, item 2, item 3, item 4 - page.10.listNum = 0 + .. rubric:: Examples - This would return "item 3" + This would return "item 1": - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page.10 = TEXT - page.10.value = item 1, item 2, item 3, item 4 - page.10.listNum = last – 1 + page.10 = TEXT + page.10.value = item 1, item 2, item 3, item 4 + page.10.listNum = 0 + This would return "item 3" -.. _stdwrap-listNum-splitChar: + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -listNum.splitChar -""""""""""""""""" + page.10 = TEXT + page.10.value = item 1, item 2, item 3, item 4 + page.10.listNum = last – 1 -.. confval:: listNum.splitChar - :name: stdwrap-listNum-splitChar - :type: :ref:`data-type-string` - :Default: `,` (comma) - .. rubric:: Examples + .. _stdwrap-listNum-splitChar: - Splits the content of the field `subtitle` by the pipe character and returns - a random element + .. confval:: listNum.splitChar + :name: stdwrap-listNum-splitChar + :type: :ref:`data-type-string` + :Default: `,` (comma) - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. rubric:: Examples - page.5 = COA_INT - page.5 { - 10 = TEXT - 10 { - stdWrap.field = subtitle - stdWrap.listNum = rand - stdWrap.listNum.splitChar = | - } - } - - -.. _stdwrap-trim: + Splits the content of the field `subtitle` by the pipe character and returns + a random element -trim -~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: trim - :name: stdwrap-trim - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + page.5 = COA_INT + page.5 { + 10 = TEXT + 10 { + stdWrap.field = subtitle + stdWrap.listNum = rand + stdWrap.listNum.splitChar = | + } + } - If set, the PHP-function :php:`trim()` will be used to remove whitespaces - around the value. + .. _stdwrap-trim: -.. _stdwrap-strPad: + .. confval:: trim + :name: stdwrap-trim + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -strPad -~~~~~~ + If set, the PHP-function :php:`trim()` will be used to remove whitespaces + around the value. -.. confval:: strPad - :name: stdwrap-strPad - :type: :ref:`strPad` - Pads the current content to a certain length. You can define the padding - characters and the side(s), on which the padding should be added. + .. _stdwrap-strPad: + .. confval:: strPad + :name: stdwrap-strPad + :type: :ref:`strPad` -.. _stdwrap-stdWrap: - -stdWrap -~~~~~~~ - -.. confval:: stdWrap - :name: stdwrap-stdWrap - :type: :ref:`stdWrap` + Pads the current content to a certain length. You can define the padding + characters and the side(s), on which the padding should be added. - Recursive call to the :typoscript:`stdWrap` function. + .. _stdwrap-stdWrap: -.. _stdwrap-required: + .. confval:: stdWrap + :name: stdwrap-stdWrap + :type: :ref:`stdWrap` -required -~~~~~~~~ + Recursive call to the :typoscript:`stdWrap` function. -.. confval:: required - :name: stdwrap-required - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - This flag requires the content to be set to some value after any - content-import and treatment that might have happened until now - (data, field, current, listNum, trim). Zero is **not** regarded as - empty! Use "if" instead! + .. _stdwrap-required: - If the content is empty, "" is returned immediately. + .. confval:: required + :name: stdwrap-required + :type: :ref:`data-type-boolean` / :ref:`stdWrap` + This flag requires the content to be set to some value after any + content-import and treatment that might have happened until now + (data, field, current, listNum, trim). Zero is **not** regarded as + empty! Use "if" instead! -.. _stdwrap-if: + If the content is empty, "" is returned immediately. -if --- -.. confval:: if - :name: stdwrap-if - :type: :ref:`if` + .. _stdwrap-if: - If the if-object returns false, stdWrap returns "" immediately. + .. confval:: if + :name: stdwrap-if + :type: :ref:`if` + If the if-object returns false, stdWrap returns "" immediately. -.. _stdwrap-fieldRequired: -fieldRequired -~~~~~~~~~~~~~ + .. _stdwrap-fieldRequired: -.. confval:: fieldRequired - :name: stdwrap-fieldRequired - :type: Field name / :ref:`stdWrap` + .. confval:: fieldRequired + :name: stdwrap-fieldRequired + :type: Field name / :ref:`stdWrap` - The value in this field **must** be set. + The value in this field **must** be set. .. _stdwrap-properties-parsing: Properties for parsing data --------------------------- -.. _stdwrap-csConv: +.. confval-menu:: + :name: stdwrap-parse + :display: table + :type: -csConv -~~~~~~ + .. _stdwrap-csConv: -.. confval:: csConv - :name: stdwrap-csConv - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. confval:: csConv + :name: stdwrap-csConv + :type: :ref:`data-type-string` / :ref:`stdWrap` - Convert the charset of the string from the charset given as value to - the current rendering charset of the frontend (UTF-8). + Convert the charset of the string from the charset given as value to + the current rendering charset of the frontend (UTF-8). -.. _stdwrap-parseFunc: + .. _stdwrap-parseFunc: -parseFunc -~~~~~~~~~ + .. confval:: parseFunc + :name: stdwrap-parseFunc + :type: object path reference / :ref:`parsefunc` / :ref:`stdWrap` -.. confval:: parseFunc - :name: stdwrap-parseFunc - :type: object path reference / :ref:`parsefunc` / :ref:`stdWrap` + Processing instructions for the content. - Processing instructions for the content. + .. Note:: + If you enter a string as value, this will be taken as a + reference to an object path globally in the TypoScript object tree. + This will be the basis configuration for parseFunc merged with any + properties you add here. It works exactly like references does for + content elements. - .. Note:: - If you enter a string as value, this will be taken as a - reference to an object path globally in the TypoScript object tree. - This will be the basis configuration for parseFunc merged with any - properties you add here. It works exactly like references does for - content elements. + .. rubric:: Examples - .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - - page.10 { - parseFunc = < lib.parseFunc_RTE - parseFunc.tags.myTag = TEXT - parseFunc.tags.myTag.value = This will be inserted when <myTag> is found! - } - -.. _stdwrap-parseFunc-sanitization: + page.10 { + parseFunc = < lib.parseFunc_RTE + parseFunc.tags.myTag = TEXT + parseFunc.tags.myTag.value = This will be inserted when <myTag> is found! + } -Sanitization -"""""""""""" + .. _stdwrap-parseFunc-sanitization: -:ref:`stdwrap-htmlSanitize` is enabled by default when -:ref:`stdwrap-parseFunc` is invoked. This also includes the Fluid Viewhelper -:html:``, since it invokes :ref:`stdwrap-parseFunc` -directly using :typoscript:`lib.parseFunc_RTE`. + :ref:`stdwrap-htmlSanitize` is enabled by default when + :ref:`stdwrap-parseFunc` is invoked. This also includes the Fluid Viewhelper + :html:``, since it invokes :ref:`stdwrap-parseFunc` + directly using :typoscript:`lib.parseFunc_RTE`. -The following example shows how to disable the sanitization behavior that is -enabled by default. This is not recommended, but it can be disabled when required. + The following example shows how to disable the sanitization behavior that is + enabled by default. This is not recommended, but it can be disabled when required. -.. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - - // either disable globally - lib.parseFunc.htmlSanitize = 0 - lib.parseFunc_RTE.htmlSanitize = 0 - - // or disable individually per use case - 10 = TEXT - 10 { - value =
- parseFunc =< lib.parseFunc_RTE - parseFunc.htmlSanitize = 0 - } + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -Since any invocation of :typoscript:`stdWrap.parseFunc` triggers HTML -sanitization automatically; unless explicitly disabled -the following example causes a lot of generated markup to be sanitized and can be -solved by explicitly disabling it with :typoscript:`htmlSanitize = 0`. + // either disable globally + lib.parseFunc.htmlSanitize = 0 + lib.parseFunc_RTE.htmlSanitize = 0 -.. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - - 10 = FLUIDTEMPLATE - 10 { - templateRootPaths { - // ... - } - variables { - // ... - } - stdWrap.parseFunc { - // replace --- with soft-hyphen - short.--- = ­ - // sanitization of ALL MARKUP is NOT DESIRED here - htmlSanitize = 0 + // or disable individually per use case + 10 = TEXT + 10 { + value =
+ parseFunc =< lib.parseFunc_RTE + parseFunc.htmlSanitize = 0 } - } - -.. _stdwrap-htmlparser: - -HTMLparser -~~~~~~~~~~ - -.. confval:: HTMLparser - :name: stdwrap-htmlparser - :type: :ref:`data-type-boolean` / :ref:`htmlparser` / :ref:`stdWrap` - - This object allows you to parse the HTML-content and perform all kinds of - advanced filtering on the content. - - Value must be set and properties are those of :ref:`htmlparser`. - - (See :ref:`t3coreapi:rte` for more information about RTE transformations) - - -.. _stdwrap-split: - -split -~~~~~ - -.. confval:: split - :name: stdwrap-split - :type: :ref:`split` / :ref:`stdWrap` - - -.. _stdwrap-replacement: - -replacement -~~~~~~~~~~~ - -.. confval:: replacement - :name: stdwrap-replacement - :type: :ref:`replacement` / :ref:`stdWrap` - - Performs an ordered search/replace on the current content with the - possibility of using PCRE regular expressions. An array with numeric - indices defines the order of actions and thus allows multiple - replacements at once. - - -.. _stdwrap-prioriCalc: - -prioriCalc -~~~~~~~~~~ - -.. confval:: prioriCalc - :name: stdwrap-prioriCalc - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - - Calculation of the value using operators -+\*/%^ plus respects - priority to + and - operators and parenthesis levels (). - - . (period) is decimal delimiter. - - Returns a doublevalue. - - If :typoscript:`prioriCalc` is set to "intval" an integer is returned. - - There is no error checking and division by zero or other invalid - values may generate strange results. Also you should use a proper syntax - because future modifications to the function used may allow for more - operators and features. - - .. rubric:: Examples - - .. code-block:: none - :caption: Example Output for different calculations - - 100%7 = 2 - -5*-4 = 20 - +6^2 = 36 - 6 ^(1+1) = 36 - -5*-4+6^2-100%7 = 54 - -5 * (-4+6) ^ 2 - 100%7 = 98 - -5 * ((-4+6) ^ 2) - 100%7 = -22 - - -.. _stdwrap-char: - -char -~~~~ - -.. confval:: char - :name: stdwrap-char - :type: :ref:`data-type-integer` / :ref:`stdWrap` - - Content is set to :php:`chr(*value*)`. This returns a one-character - string containing the character specified by ascii code. Reliable - results will be obtained only for character codes in the integer - range 0 - 127. See - `the PHP manual `_: - - .. code-block:: php - - $content = chr((int)$conf['char']); - -.. _stdwrap-intval: + Since any invocation of :typoscript:`stdWrap.parseFunc` triggers HTML + sanitization automatically; unless explicitly disabled + the following example causes a lot of generated markup to be sanitized and can be + solved by explicitly disabling it with :typoscript:`htmlSanitize = 0`. -intval -~~~~~~ - -.. confval:: intval - :name: stdwrap-intval - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - - PHP function :php:`intval()` returns an integer: - - .. code-block:: php - - $content = intval($content); - - -.. _stdwrap-hash: - -hash -~~~~ - -.. confval:: hash - :name: stdwrap-hash - :type: :ref:`data-type-string` / :ref:`stdWrap` - - Returns a hashed value of the current content. Set to one of the - algorithms which are available in PHP. For a list of supported - algorithms see https://www.php.net/manual/en/function.hash-algos.php. - - .. rubric:: Examples .. code-block:: typoscript :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page.10 = TEXT - page.10 { - value = test@example.org - stdWrap.hash = md5 - stdWrap.wrap = + 10 = FLUIDTEMPLATE + 10 { + templateRootPaths { + // ... + } + variables { + // ... + } + stdWrap.parseFunc { + // replace --- with soft-hyphen + short.--- = ­ + // sanitization of ALL MARKUP is NOT DESIRED here + htmlSanitize = 0 + } } + .. _stdwrap-htmlparser: -.. _stdwrap-round: + .. confval:: HTMLparser + :name: stdwrap-htmlparser + :type: :ref:`data-type-boolean` / :ref:`htmlparser` / :ref:`stdWrap` -round -~~~~~ + This object allows you to parse the HTML-content and perform all kinds of + advanced filtering on the content. -.. confval:: round - :name: stdwrap-round - :type: :ref:`round` / :ref:`stdWrap` + Value must be set and properties are those of :ref:`htmlparser`. - Round the value with the selected method to the given number of - decimals. + (See :ref:`t3coreapi:rte` for more information about RTE transformations) -.. _stdwrap-numberFormat: + .. _stdwrap-split: -numberFormat -~~~~~~~~~~~~ + .. confval:: split + :name: stdwrap-split + :type: :ref:`split` / :ref:`stdWrap` -.. confval:: numberFormat - :name: stdwrap-numberFormat - :type: :ref:`numberformat` - Format a float value to any number format you need (e.g. useful for - prices). + .. _stdwrap-replacement: + .. confval:: replacement + :name: stdwrap-replacement + :type: :ref:`replacement` / :ref:`stdWrap` -.. _stdwrap-date: + Performs an ordered search/replace on the current content with the + possibility of using PCRE regular expressions. An array with numeric + indices defines the order of actions and thus allows multiple + replacements at once. -date -~~~~ -.. confval:: date - :name: stdwrap-date - :type: :ref:`data-type-date-conf` / :ref:`stdWrap` + .. _stdwrap-prioriCalc: - The content should be data-type "UNIX-time". Returns the content - formatted as a date. See the PHP manual (`datetime.format `_) - for the format codes. + .. confval:: prioriCalc + :name: stdwrap-prioriCalc + :type: :ref:`data-type-boolean` / :ref:`stdWrap` + Calculation of the value using operators -+\*/%^ plus respects + priority to + and - operators and parenthesis levels (). - .. code-block:: php + . (period) is decimal delimiter. - $content = date($conf['date'], $content); + Returns a doublevalue. - Properties: + If :typoscript:`prioriCalc` is set to "intval" an integer is returned. - **.GMT:** If set, the PHP function `gmdate() `_ will be - used instead of `date() `_. + There is no error checking and division by zero or other invalid + values may generate strange results. Also you should use a proper syntax + because future modifications to the function used may allow for more + operators and features. - .. rubric:: Examples + .. rubric:: Examples - Render in human readable form: + .. code-block:: none + :caption: Example Output for different calculations - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + 100%7 = 2 + -5*-4 = 20 + +6^2 = 36 + 6 ^(1+1) = 36 + -5*-4+6^2-100%7 = 54 + -5 * (-4+6) ^ 2 - 100%7 = 98 + -5 * ((-4+6) ^ 2) - 100%7 = -22 - page.10 = TEXT - page.10.value { - # format like 2017-05-31 09:08 - field = tstamp - date = Y-m-d H:i - } - .. note:: - You should consider using the more flexible function - :ref:`stdwrap-formattedDate`. + .. _stdwrap-char: + .. confval:: char + :name: stdwrap-char + :type: :ref:`data-type-integer` / :ref:`stdWrap` -.. _stdwrap-strtotime: + Content is set to :php:`chr(*value*)`. This returns a one-character + string containing the character specified by ascii code. Reliable + results will be obtained only for character codes in the integer + range 0 - 127. See + `the PHP manual `_: -strtotime -~~~~~~~~~ + .. code-block:: php -.. confval:: strtotime - :name: stdwrap-strtotime - :type: :ref:`data-type-string` + $content = chr((int)$conf['char']); - Allows conversion of formatted dates to timestamp, e.g. to perform date calculations. - Possible values are :typoscript:`1` or any time string valid as first argument of the PHP :php:`strtotime()` function. + .. _stdwrap-intval: - .. rubric:: Examples + .. confval:: intval + :name: stdwrap-intval + :type: :ref:`data-type-boolean` / :ref:`stdWrap` - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + PHP function :php:`intval()` returns an integer: - lib.date_as_timestamp = TEXT - lib.date_as_timestamp { - value = 2015-04-15 - strtotime = 1 - } + .. code-block:: php - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + $content = intval($content); - lib.next_weekday = TEXT - lib.next_weekday { - data = GP:selected_date - strtotime = + 2 weekdays - strftime = %Y-%m-%d - } + .. _stdwrap-hash: -.. _data-type-strftime-conf: -.. _stdwrap-strftime: + .. confval:: hash + :name: stdwrap-hash + :type: :ref:`data-type-string` / :ref:`stdWrap` -strftime -~~~~~~~~ + Returns a hashed value of the current content. Set to one of the + algorithms which are available in PHP. For a list of supported + algorithms see https://www.php.net/manual/en/function.hash-algos.php. -.. confval:: strftime - :name: stdwrap-strftime - :type: :ref:`data-type-strftime-conf` / :ref:`stdWrap` + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Very similar to "date", but using a different format. See the PHP manual (`strftime `_) for the - format codes. + page.10 = TEXT + page.10 { + value = test@example.org + stdWrap.hash = md5 + stdWrap.wrap = + } - This formatting is useful if the locale is set in advance in the - :ref:`CONFIG ` object. See there. - Properties: + .. _stdwrap-round: - .charset - Can be set to the charset of the output string if you need to - convert it to UTF-8. Default is to take the intelligently guessed - charset from :php:`TYPO3\CMS\Core\Charset\CharsetConverter`. + .. confval:: round + :name: stdwrap-round + :type: :ref:`round` / :ref:`stdWrap` - .GMT - If set, the PHP function `gmstrftime() - `_ will be used instead of - `strftime() `_. + Round the value with the selected method to the given number of + decimals. - .. note:: - You should consider using the more flexible function - :ref:`stdwrap-formattedDate`. + .. _stdwrap-numberFormat: -.. _stdwrap-formattedDate: + .. confval:: numberFormat + :name: stdwrap-numberFormat + :type: :ref:`numberformat` -formattedDate -~~~~~~~~~~~~~ + Format a float value to any number format you need (e.g. useful for + prices). -.. confval:: formattedDate - :name: stdwrap-formattedDate - :type: :ref:`data-type-string` - The function renders date and time based on formats/patterns defined by - the International Components for Unicode standard (ICU). ICU-based date and - time formatting is much more flexible in rendering as - :ref:`stdwrap-date` or :ref:`stdwrap-strftime`, as it ships - with default patterns for date and time based on the given locale (given - examples for locale `en-US` and timezone `America/Los_Angeles`): + .. _stdwrap-date: - * `FULL`, for example: `Friday, March 17, 2023 at 3:00:00 AM Pacific Daylight Time` - * `LONG`, for example: `March 17, 2023 at 3:00:00 AM PDT` - * `MEDIUM`, for example: `Mar 17, 2023, 3:00:00 AM` - * `SHORT`, for example: `3/17/23, 3:00 AM` + .. confval:: date + :name: stdwrap-date + :type: :ref:`data-type-date-conf` / :ref:`stdWrap` - TYPO3 also adds prepared custom patterns: + The content should be data-type "UNIX-time". Returns the content + formatted as a date. See the PHP manual (`datetime.format `_) + for the format codes. - * `FULLDATE`, for example: `Friday, March 17, 2023` - * `FULLTIME`, for example: `3:00:00 AM Pacific Daylight Time` - * `LONGDATE`, for example: `March 17, 2023` - * `LONGTIME`, for example: `3:00:00 AM PDT` - * `MEDIUMDATE`, for example: `Mar 17, 2023` - * `MEDIUMTIME`, for example: `3:00:00 AM` - * `SHORTDATE`, for example: `3/17/23` - * `SHORTTIME`, for example: `3:00 AM` - .. note:: - You can specify an own pattern to suit your requirements, for example: - `qqqq, yyyy` will result in `1st quarter, 2023`. Have a look into the - `available options `__. + .. code-block:: php - The locale is typically fetched from the - :ref:`locale setting ` in the - site configuration. + $content = date($conf['date'], $content); - Properties: + Properties: - .locale - A locale other than the locale of the site language. + **.GMT:** If set, the PHP function `gmdate() `_ will be + used instead of `date() `_. - .. rubric:: Example: Full German output from a date/time value + .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Render in human readable form: - lib.my_formatted_date = TEXT - lib.my_formatted_date { - value = 2023-03-17 3:00:00 - formattedDate = FULL - # Optional, if a different locale is wanted other than the site language's locale - formattedDate.locale = de-DE - } + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - will result in "Freitag, 17. März 2023 um 03:00:00 Nordamerikanische Westküsten-Sommerzeit". + page.10 = TEXT + page.10.value { + # format like 2017-05-31 09:08 + field = tstamp + date = Y-m-d H:i + } - .. rubric:: Example: Full French output from a relative date value + .. note:: + You should consider using the more flexible function + :ref:`stdwrap-formattedDate`. - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - lib.my_formatted_date = TEXT - lib.my_formatted_date { - value = -5 days - formattedDate = FULL - formattedDate.locale = fr-FR - } + .. _stdwrap-strtotime: - will result in "dimanche 12 mars 2023 à 11:16:44 heure d’été du Pacifique". + .. confval:: strtotime + :name: stdwrap-strtotime + :type: :ref:`data-type-string` - .. rubric:: Example: Custom format from a timestamp + Allows conversion of formatted dates to timestamp, e.g. to perform date calculations. - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Possible values are :typoscript:`1` or any time string valid as first argument of the PHP :php:`strtotime()` function. - lib.my_formatted_date = TEXT - lib.my_formatted_date { - value = 1679022000 - formattedDate = Y-MM-dd'T'HH:mm:ssZ - } + .. rubric:: Examples - will return the date in the ISO 8601 format: "2023-03-17T03:00:00+00:00" + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - .. note:: - The timezone will be taken from the setting `date.timezone` in your - :file:`php.ini`. + lib.date_as_timestamp = TEXT + lib.date_as_timestamp { + value = 2015-04-15 + strtotime = 1 + } + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. _stdwrap-age: + lib.next_weekday = TEXT + lib.next_weekday { + data = GP:selected_date + strtotime = + 2 weekdays + strftime = %Y-%m-%d + } -age -~~~ -.. confval:: age - :name: stdwrap-age - :type: :ref:`data-type-boolean` or :ref:`data-type-string` / :ref:`stdWrap` + .. _data-type-strftime-conf: + .. _stdwrap-strftime: - If enabled with a "1" (number, integer) the content is seen as a date - (UNIX-time) and the difference from present time and the content-time - is returned as one of these eight variations: + .. confval:: strftime + :name: stdwrap-strftime + :type: :ref:`data-type-strftime-conf` / :ref:`stdWrap` - "xx min" or "xx hrs" or "xx days" or "xx yrs" or "xx min" or "xx hour" - or "xx day" or "year" + Very similar to "date", but using a different format. See the PHP manual (`strftime `_) for the + format codes. - The limits between which layout is used are 60 minutes, 24 hours and - 365 days. + This formatting is useful if the locale is set in advance in the + :ref:`CONFIG ` object. See there. - If you set this property with a non-integer, it is used to format the - eight units. The first four values are the plural values and the last - four are singular. This is the default string: + Properties: - .. code-block:: none - :caption: Default string for age format + .charset + Can be set to the charset of the output string if you need to + convert it to UTF-8. Default is to take the intelligently guessed + charset from :php:`TYPO3\CMS\Core\Charset\CharsetConverter`. - min| hrs| days| yrs| min| hour| day| year + .GMT + If set, the PHP function `gmstrftime() + `_ will be used instead of + `strftime() `_. - Set another string if you want to change the units. You may include - the "-signs. They are removed anyway, but they make sure that a space - which you might want between the number and the unit stays. + .. note:: + You should consider using the more flexible function + :ref:`stdwrap-formattedDate`. - .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - lib.ageFormat = TEXT - lib.ageFormat.stdWrap.data = page:tstamp - lib.ageFormat.stdWrap.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr" + .. _stdwrap-formattedDate: + .. confval:: formattedDate + :name: stdwrap-formattedDate + :type: :ref:`data-type-string` -.. _data-type-case: -.. _stdwrap-case: + The function renders date and time based on formats/patterns defined by + the International Components for Unicode standard (ICU). ICU-based date and + time formatting is much more flexible in rendering as + :ref:`stdwrap-date` or :ref:`stdwrap-strftime`, as it ships + with default patterns for date and time based on the given locale (given + examples for locale `en-US` and timezone `America/Los_Angeles`): -case -~~~~ + * `FULL`, for example: `Friday, March 17, 2023 at 3:00:00 AM Pacific Daylight Time` + * `LONG`, for example: `March 17, 2023 at 3:00:00 AM PDT` + * `MEDIUM`, for example: `Mar 17, 2023, 3:00:00 AM` + * `SHORT`, for example: `3/17/23, 3:00 AM` -.. confval:: case - :name: stdwrap-case - :type: string / :ref:`stdWrap` + TYPO3 also adds prepared custom patterns: - Converts case + * `FULLDATE`, for example: `Friday, March 17, 2023` + * `FULLTIME`, for example: `3:00:00 AM Pacific Daylight Time` + * `LONGDATE`, for example: `March 17, 2023` + * `LONGTIME`, for example: `3:00:00 AM PDT` + * `MEDIUMDATE`, for example: `Mar 17, 2023` + * `MEDIUMTIME`, for example: `3:00:00 AM` + * `SHORTDATE`, for example: `3/17/23` + * `SHORTTIME`, for example: `3:00 AM` - Uses "UTF-8" for the operation. + .. note:: + You can specify an own pattern to suit your requirements, for example: + `qqqq, yyyy` will result in `1st quarter, 2023`. Have a look into the + `available options `__. - .. rubric:: Possible values: + The locale is typically fetched from the + :ref:`locale setting ` in the + site configuration. - ============================= ========================================================== - Value Effect - ============================= ========================================================== - :typoscript:`upper` Convert all letters of the string to upper case - :typoscript:`lower` Convert all letters of the string to lower case - :typoscript:`capitalize` Uppercase the first character of each word in the string - :typoscript:`ucfirst` Convert the first letter of the string to upper case - :typoscript:`lcfirst` Convert the first letter of the string to lower case - :typoscript:`uppercamelcase` Convert underscored `upper_camel_case` to `UpperCamelCase` - :typoscript:`lowercamelcase` Convert underscored `lower_camel_case` to `lowerCamelCase` - ============================= ========================================================== + Properties: - .. rubric:: Example + .locale + A locale other than the locale of the site language. - Code: + .. rubric:: Example: Full German output from a date/time value - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - 10 = TEXT - 10.value = Hello world! - 10.case = upper + lib.my_formatted_date = TEXT + lib.my_formatted_date { + value = 2023-03-17 3:00:00 + formattedDate = FULL + # Optional, if a different locale is wanted other than the site language's locale + formattedDate.locale = de-DE + } - Result: + will result in "Freitag, 17. März 2023 um 03:00:00 Nordamerikanische Westküsten-Sommerzeit". - .. code-block:: text - :caption: Example Output + .. rubric:: Example: Full French output from a relative date value - HELLO WORLD! + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + lib.my_formatted_date = TEXT + lib.my_formatted_date { + value = -5 days + formattedDate = FULL + formattedDate.locale = fr-FR + } -.. _stdwrap-bytes: + will result in "dimanche 12 mars 2023 à 11:16:44 heure d’été du Pacifique". -bytes -~~~~~ + .. rubric:: Example: Custom format from a timestamp -.. confval:: bytes - :name: stdwrap-bytes - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - :Default: iec, 1024 + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - This is for number values. When the 'bytes' property is added and set - to 'true' then a number will be formatted in 'bytes' style with two - decimals like '1.53 KiB' or '1.00 MiB'. - Learn about common notations at - `Wikipedia "Kibibyte" `__. - IEC naming with base 1024 is the default. Use sub-properties for - customisation. + lib.my_formatted_date = TEXT + lib.my_formatted_date { + value = 1679022000 + formattedDate = Y-MM-dd'T'HH:mm:ssZ + } - .labels = iec - This is the default. IEC labels and base 1024 are used. - Built in IEC labels are :typoscript:`" | Ki| Mi| Gi| Ti| Pi| Ei| Zi| Yi"`. - You need to append a final string like 'B' or '-Bytes' yourself. + will return the date in the ISO 8601 format: "2023-03-17T03:00:00+00:00" - .labels = si - In this case SI labels and base 1000 are used. - Built in IEC labels are :typoscript:`" | k| M| G| T| P| E| Z| Y"`. - You need to append a final string like 'B' yourself. + .. note:: + The timezone will be taken from the setting `date.timezone` in your + :file:`php.ini`. - .labels = "..." - Custom values can be defined as well like with - :typoscript:`.labels = " Byte| Kilobyte| Megabyte| Gigabyte"`. Use a - vertical bar to separate the labels. Enclose the whole string in - double quotes. - .base = 1000 - Only with custom labels you can choose to set a base of1000. All - other values, including the default, mean base 1024. + .. _stdwrap-age: - .. attention:: + .. confval:: age + :name: stdwrap-age + :type: :ref:`data-type-boolean` or :ref:`data-type-string` / :ref:`stdWrap` - If the value isn't a number the internal PHP function may issue a - warning which - depending on you error handling settings - can - interrupt execution. Example: + If enabled with a "1" (number, integer) the content is seen as a date + (UNIX-time) and the difference from present time and the content-time + is returned as one of these eight variations: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + "xx min" or "xx hrs" or "xx days" or "xx yrs" or "xx min" or "xx hour" + or "xx day" or "year" - page.10 { - value = abc - bytes = 1 - } + The limits between which layout is used are 60 minutes, 24 hours and + 365 days. - will show `0` but may raise a warning or an exception. + If you set this property with a non-integer, it is used to format the + eight units. The first four values are the plural values and the last + four are singular. This is the default string: - .. rubric:: Examples + .. code-block:: none + :caption: Default string for age format - Output value 1000 without special formatting. Shows `1000`: + min| hrs| days| yrs| min| hour| day| year - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Set another string if you want to change the units. You may include + the "-signs. They are removed anyway, but they make sure that a space + which you might want between the number and the unit stays. - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - } + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Format value 1000 in IEC style with base=1024. Shows `0.98 Ki`: + lib.ageFormat = TEXT + lib.ageFormat.stdWrap.data = page:tstamp + lib.ageFormat.stdWrap.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr" - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - } + .. _data-type-case: + .. _stdwrap-case: - Format value 1000 in IEC style with base=1024 and 'B' supplied by us. - Shows `0.98 KiB`: + .. confval:: case + :name: stdwrap-case + :type: string / :ref:`stdWrap` - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Converts case - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - noTrimWrap = ||B| - } + Uses "UTF-8" for the operation. - Format value 1000 in SI style with base=1000. Shows `1.00 k`: + .. rubric:: Possible values: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + ============================= ========================================================== + Value Effect + ============================= ========================================================== + :typoscript:`upper` Convert all letters of the string to upper case + :typoscript:`lower` Convert all letters of the string to lower case + :typoscript:`capitalize` Uppercase the first character of each word in the string + :typoscript:`ucfirst` Convert the first letter of the string to upper case + :typoscript:`lcfirst` Convert the first letter of the string to lower case + :typoscript:`uppercamelcase` Convert underscored `upper_camel_case` to `UpperCamelCase` + :typoscript:`lowercamelcase` Convert underscored `lower_camel_case` to `lowerCamelCase` + ============================= ========================================================== - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - bytes.labels = si - } + .. rubric:: Example - Format value 1000 in SI style with base=1000 and 'b' supplied by us. - Shows `1.00 kb`: + Code: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - bytes.labels = si - noTrimWrap = ||b| - } + 10 = TEXT + 10.value = Hello world! + 10.case = upper - Format value 1000 with custom label and base=1000. Shows - `1.00 x 1000 Bytes`: + Result: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. code-block:: text + :caption: Example Output - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - bytes.labels = " x 1 Byte| x 1000 Bytes" - bytes.base = 1000 - } + HELLO WORLD! - Format value 1000 with custom label and base=1000. Shows - `1.00 kilobyte (kB)`: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. _stdwrap-bytes: - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - bytes.labels = " byte (B)| kilobyte (kB)| megabyte (MB)| gigabyte (GB)| terabyte (TB)| petabyte (PB)| exabyte (EB)| zettabyte (ZB)| yottabyte YB" - bytes.base = 1000 - } + .. confval:: bytes + :name: stdwrap-bytes + :type: :ref:`data-type-boolean` / :ref:`stdWrap` + :Default: iec, 1024 - Format value 1000 with custom label and base=1024. Shows - `0.98 kibibyte (KiB)`: + This is for number values. When the 'bytes' property is added and set + to 'true' then a number will be formatted in 'bytes' style with two + decimals like '1.53 KiB' or '1.00 MiB'. + Learn about common notations at + `Wikipedia "Kibibyte" `__. + IEC naming with base 1024 is the default. Use sub-properties for + customisation. - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .labels = iec + This is the default. IEC labels and base 1024 are used. + Built in IEC labels are :typoscript:`" | Ki| Mi| Gi| Ti| Pi| Ei| Zi| Yi"`. + You need to append a final string like 'B' or '-Bytes' yourself. - page = PAGE - page.10 = TEXT - page.10 { - value = 1000 - bytes = 1 - bytes.labels = " byte (B)| kibibyte (KiB)| mebibyte (MiB)| gibibyte (GiB)| tebibyte (TiB)| pepibyte (PiB)| exbibyte (EiB)| zebibyte (ZiB)| yobibyte YiB" - bytes.base = 1024 - } + .labels = si + In this case SI labels and base 1000 are used. + Built in IEC labels are :typoscript:`" | k| M| G| T| P| E| Z| Y"`. + You need to append a final string like 'B' yourself. + .labels = "..." + Custom values can be defined as well like with + :typoscript:`.labels = " Byte| Kilobyte| Megabyte| Gigabyte"`. Use a + vertical bar to separate the labels. Enclose the whole string in + double quotes. -.. _stdwrap-substring: + .base = 1000 + Only with custom labels you can choose to set a base of1000. All + other values, including the default, mean base 1024. -substring -~~~~~~~~~ + .. attention:: -.. confval:: substring - :name: stdwrap-substring - :type: [p1], [p2] / :ref:`stdWrap` + If the value isn't a number the internal PHP function may issue a + warning which - depending on you error handling settings - can + interrupt execution. Example: - Returns the substring with [p1] and [p2] sent as the 2nd and 3rd - parameter to the PHP `mb_substr `__ function. + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Uses "UTF-8" for the operation. + page.10 { + value = abc + bytes = 1 + } + will show `0` but may raise a warning or an exception. -.. _stdwrap-cropHTML: + .. rubric:: Examples -cropHTML -~~~~~~~~ + Output value 1000 without special formatting. Shows `1000`: -.. confval:: cropHTML - :name: stdwrap-cropHTML - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Crops the content to a certain length. In contrast to :typoscript:`stdWrap.crop` it - respects HTML tags. It does not crop inside tags and closes open tags. - Entities (like ">") are counted as one char. See :typoscript:`stdWrap.crop` below - for a syntax description and examples. + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + } - Note that :typoscript:`stdWrap.crop` should not be used if :typoscript:`stdWrap.cropHTML` is - already used. + Format value 1000 in IEC style with base=1024. Shows `0.98 Ki`: + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + } -.. _stdwrap-stripHtml: + Format value 1000 in IEC style with base=1024 and 'B' supplied by us. + Shows `0.98 KiB`: -stripHtml -~~~~~~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: stripHtml - :name: stdwrap-stripHtml - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + noTrimWrap = ||B| + } - Strips all HTML tags. + Format value 1000 in SI style with base=1000. Shows `1.00 k`: + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. _stdwrap-crop: + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + bytes.labels = si + } -crop -~~~~ + Format value 1000 in SI style with base=1000 and 'b' supplied by us. + Shows `1.00 kb`: -.. confval:: crop - :name: stdwrap-crop - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Crops the content to a certain length. + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + bytes.labels = si + noTrimWrap = ||b| + } - You can define up to three parameters, of which the third one is - optional. The syntax is: - [numbers of characters to keep] \| [ellipsis] \| [keep whole words] + Format value 1000 with custom label and base=1000. Shows + `1.00 x 1000 Bytes`: - numbers of characters to keep (integer): Define the number of characters - you want to keep. For positive numbers, the first characters from the - beginning of the string will be kept, for negative numbers the last - characters from the end will be kept. + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - ellipsis (string): The signs to be added instead of the part, which was - cropped of. If the number of characters was positive, the string will - be *prepended* with the ellipsis, if it was negative, the string will - be *appended* with the ellipsis. + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + bytes.labels = " x 1 Byte| x 1000 Bytes" + bytes.base = 1000 + } - keep whole words (boolean): If set to 0 (default), the string is always - cropped directly after the defined number of characters. If set to 1, - only complete words are kept. Then a word, which would normally be cut - in the middle, is removed completely. + Format value 1000 with custom label and base=1000. Shows + `1.00 kilobyte (kB)`: - .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - :typoscript:`20 | ...` => max 20 characters. If more, the value will be truncated - to the first 20 characters and prepended with "..." + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + bytes.labels = " byte (B)| kilobyte (kB)| megabyte (MB)| gigabyte (GB)| terabyte (TB)| petabyte (PB)| exabyte (EB)| zettabyte (ZB)| yottabyte YB" + bytes.base = 1000 + } - :typoscript:`-20 | ...` => max 20 characters. If more, the value will be truncated - to the last 20 characters and appended with "..." + Format value 1000 with custom label and base=1024. Shows + `0.98 kibibyte (KiB)`: - :typoscript:`20 | ... | 1` => max 20 characters. If more, the value will be - truncated to the first 20 characters and prepended with "...". If - the division is in the middle of a word, the remains of that word is - removed. + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - Uses "UTF-8" for the operation. + page = PAGE + page.10 = TEXT + page.10 { + value = 1000 + bytes = 1 + bytes.labels = " byte (B)| kibibyte (KiB)| mebibyte (MiB)| gibibyte (GiB)| tebibyte (TiB)| pepibyte (PiB)| exbibyte (EiB)| zebibyte (ZiB)| yobibyte YiB" + bytes.base = 1024 + } -.. _stdwrap-rawUrlEncode: + .. _stdwrap-substring: -rawUrlEncode -~~~~~~~~~~~~ + .. confval:: substring + :name: stdwrap-substring + :type: [p1], [p2] / :ref:`stdWrap` -.. confval:: rawUrlEncode - :name: stdwrap-rawUrlEncode - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + Returns the substring with [p1] and [p2] sent as the 2nd and 3rd + parameter to the PHP `mb_substr `__ function. - Passes the content through the PHP function `rawurlencode() `_. + Uses "UTF-8" for the operation. -.. _stdwrap-htmlSpecialChars: + .. _stdwrap-cropHTML: -htmlSpecialChars -~~~~~~~~~~~~~~~~ + .. confval:: cropHTML + :name: stdwrap-cropHTML + :type: :ref:`data-type-string` / :ref:`stdWrap` -.. confval:: htmlSpecialChars - :name: stdwrap-htmlSpecialChars - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + Crops the content to a certain length. In contrast to :typoscript:`stdWrap.crop` it + respects HTML tags. It does not crop inside tags and closes open tags. + Entities (like ">") are counted as one char. See :typoscript:`stdWrap.crop` below + for a syntax description and examples. - Passes the content through the PHP function `htmlspecialchars() `_. + Note that :typoscript:`stdWrap.crop` should not be used if :typoscript:`stdWrap.cropHTML` is + already used. - Additional property :typoscript:`preserveEntities` will preserve entities so only - non-entity characters are affected. + .. _stdwrap-stripHtml: -.. _stdwrap-encodeForJavaScriptValue: + .. confval:: stripHtml + :name: stdwrap-stripHtml + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -encodeForJavaScriptValue -~~~~~~~~~~~~~~~~~~~~~~~~ + Strips all HTML tags. -.. confval:: encodeForJavaScriptValue - :name: stdwrap-encodeForJavaScriptValue - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - Encodes content to be used safely inside strings in JavaScript. - Characters, which can cause problems inside JavaScript strings, are - replaced with their encoded equivalents. The resulting string is - already quoted with single quotes. + .. _stdwrap-crop: - Passes the content through the core function - :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue()`. + .. confval:: crop + :name: stdwrap-crop + :type: :ref:`data-type-string` / :ref:`stdWrap` - .. rubric:: Examples + Crops the content to a certain length. - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + You can define up to three parameters, of which the third one is + optional. The syntax is: + [numbers of characters to keep] \| [ellipsis] \| [keep whole words] - 10 = TEXT - 10.stdWrap { - data = GP:sWord - encodeForJavaScriptValue = 1 - wrap = setSearchWord(|); - } + numbers of characters to keep (integer): Define the number of characters + you want to keep. For positive numbers, the first characters from the + beginning of the string will be kept, for negative numbers the last + characters from the end will be kept. + ellipsis (string): The signs to be added instead of the part, which was + cropped of. If the number of characters was positive, the string will + be *prepended* with the ellipsis, if it was negative, the string will + be *appended* with the ellipsis. -.. _stdwrap-doubleBrTag: + keep whole words (boolean): If set to 0 (default), the string is always + cropped directly after the defined number of characters. If set to 1, + only complete words are kept. Then a word, which would normally be cut + in the middle, is removed completely. -doubleBrTag -~~~~~~~~~~~ + .. rubric:: Examples -.. confval:: doubleBrTag - :name: stdwrap-doubleBrTag - :type: :ref:`data-type-string` / :ref:`stdWrap` + :typoscript:`20 | ...` => max 20 characters. If more, the value will be truncated + to the first 20 characters and prepended with "..." - All double line breaks are substituted with this value. + :typoscript:`-20 | ...` => max 20 characters. If more, the value will be truncated + to the last 20 characters and appended with "..." + :typoscript:`20 | ... | 1` => max 20 characters. If more, the value will be + truncated to the first 20 characters and prepended with "...". If + the division is in the middle of a word, the remains of that word is + removed. -.. _stdwrap-br: + Uses "UTF-8" for the operation. -br -~~ -.. confval:: br - :name: stdwrap-br - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + .. _stdwrap-rawUrlEncode: - Pass the value through the PHP function `nl2br() `__. This - converts each line break to a :html:`
` or a :html:`
` tag depending on doctype. + .. confval:: rawUrlEncode + :name: stdwrap-rawUrlEncode + :type: :ref:`data-type-boolean` / :ref:`stdWrap` + Passes the content through the PHP function `rawurlencode() `_. -.. _stdwrap-brTag: -brTag -~~~~~ + .. _stdwrap-htmlSpecialChars: -.. confval:: brTag - :name: stdwrap-brTag - :type: :ref:`data-type-string` / :ref:`stdWrap` + .. confval:: htmlSpecialChars + :name: stdwrap-htmlSpecialChars + :type: :ref:`data-type-boolean` / :ref:`stdWrap` - All ASCII codes of "10" (line feed, LF) are substituted with the - *value*, which has been provided in this property. + Passes the content through the PHP function `htmlspecialchars() `_. + Additional property :typoscript:`preserveEntities` will preserve entities so only + non-entity characters are affected. -.. _stdwrap-encapsLines: -encapsLines -~~~~~~~~~~~ + .. _stdwrap-encodeForJavaScriptValue: -.. confval:: encapsLines - :name: stdwrap-encapsLines - :type: :ref:`encapslines` / :ref:`stdWrap` + .. confval:: encodeForJavaScriptValue + :name: stdwrap-encodeForJavaScriptValue + :type: :ref:`data-type-boolean` / :ref:`stdWrap` - Lets you split the content by :php:`chr(10)` and process each line - independently. Used to format content made with the RTE. + Encodes content to be used safely inside strings in JavaScript. + Characters, which can cause problems inside JavaScript strings, are + replaced with their encoded equivalents. The resulting string is + already quoted with single quotes. + Passes the content through the core function + :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue()`. -.. _stdwrap-keywords: + .. rubric:: Examples -keywords -~~~~~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: keywords - :name: stdwrap-keywords - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + 10 = TEXT + 10.stdWrap { + data = GP:sWord + encodeForJavaScriptValue = 1 + wrap = setSearchWord(|); + } - Splits the content by characters "," ";" and php:`chr(10)` (return), trims - each value and returns a comma-separated list of the values. + .. _stdwrap-doubleBrTag: -.. _stdwrap-innerWrap: + .. confval:: doubleBrTag + :name: stdwrap-doubleBrTag + :type: :ref:`data-type-string` / :ref:`stdWrap` -innerWrap -~~~~~~~~~ + All double line breaks are substituted with this value. -.. confval:: innerWrap - :name: stdwrap-innerWrap - :type: :ref:`wrap ` / :ref:`stdWrap` - Wraps the content. + .. _stdwrap-br: + .. confval:: br + :name: stdwrap-br + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -.. _stdwrap-innerWrap2: + Pass the value through the PHP function `nl2br() `__. This + converts each line break to a :html:`
` or a :html:`
` tag depending on doctype. -innerWrap2 -~~~~~~~~~~ -.. confval:: innerWrap2 - :name: stdwrap-innerWrap2 - :type: :ref:`wrap ` / :ref:`stdWrap` + .. _stdwrap-brTag: - Same as :typoscript:`innerWrap` (but watch the order in which they are executed). + .. confval:: brTag + :name: stdwrap-brTag + :type: :ref:`data-type-string` / :ref:`stdWrap` + All ASCII codes of "10" (line feed, LF) are substituted with the + *value*, which has been provided in this property. -.. _stdwrap-preCObject: -preCObject -~~~~~~~~~~ + .. _stdwrap-encapsLines: -.. confval:: preCObject - :name: stdwrap-preCObject - :type: :ref:`data-type-cobject` + .. confval:: encapsLines + :name: stdwrap-encapsLines + :type: :ref:`encapslines` / :ref:`stdWrap` - :ref:`stdwrap-cObject` prepended the content. + Lets you split the content by :php:`chr(10)` and process each line + independently. Used to format content made with the RTE. -.. _stdwrap-postCObject: + .. _stdwrap-keywords: -postCObject -~~~~~~~~~~~ + .. confval:: keywords + :name: stdwrap-keywords + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -.. confval:: postCObject - :name: stdwrap-postCObject - :type: :ref:`data-type-cobject` + Splits the content by characters "," ";" and php:`chr(10)` (return), trims + each value and returns a comma-separated list of the values. - :ref:`stdwrap-cObject` appended the content. +.. _stdwrap-properties-wrap: -.. _data-type-align: -.. _stdwrap-wrapAlign: +Properties for wrapping data +---------------------------- -wrapAlign -~~~~~~~~~ +.. confval-menu:: + :name: stdwrap-wrap + :display: table + :type: -.. confval:: wrapAlign - :name: stdwrap-wrapAlign - :type: string / :ref:`stdWrap` - :Allowed values: :typoscript:`left`, :typoscript:`center`, :typoscript:`right` + .. _stdwrap-innerWrap: - Wraps content with :typoscript:`
|
` - *if* align is set. + .. confval:: innerWrap + :name: stdwrap-innerWrap + :type: :ref:`wrap ` / :ref:`stdWrap` + Wraps the content. -.. _stdwrap-typolink: -typolink -~~~~~~~~ + .. _stdwrap-innerWrap2: -.. confval:: typolink - :name: stdwrap-typolink - :type: :ref:`typolink` / :ref:`stdWrap` + .. confval:: innerWrap2 + :name: stdwrap-innerWrap2 + :type: :ref:`wrap ` / :ref:`stdWrap` - Wraps the content with a link tag. + Same as :typoscript:`innerWrap` (but watch the order in which they are executed). -.. _stdwrap-wrap: + .. _stdwrap-preCObject: -wrap -~~~~ + .. confval:: preCObject + :name: stdwrap-preCObject + :type: :ref:`data-type-cobject` -.. confval:: wrap - :name: stdwrap-wrap - :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` + :ref:`stdwrap-cObject` prepended the content. - :typoscript:`splitChar` defines an alternative splitting character (default is "\|" - - the vertical line) -.. _stdwrap-noTrimWrap: + .. _stdwrap-postCObject: -noTrimWrap -~~~~~~~~~~ + .. confval:: postCObject + :name: stdwrap-postCObject + :type: :ref:`data-type-cobject` -.. confval:: noTrimWrap - :name: stdwrap-noTrimWrap - :type: "special" wrap /+.splitChar / :ref:`stdWrap` + :ref:`stdwrap-cObject` appended the content. - This wraps the content *without* trimming the values. That means that - surrounding whitespaces stay included! Note that this kind of wrap - does not only need a special character in the middle, but that it also - needs the same special character to begin and end the wrap (default - for all three is "\|"). - **Additional property:** + .. _data-type-align: + .. _stdwrap-wrapAlign: - :typoscript:`splitChar` + .. confval:: wrapAlign + :name: stdwrap-wrapAlign + :type: string / :ref:`stdWrap` + :Allowed values: :typoscript:`left`, :typoscript:`center`, :typoscript:`right` - Can be set to define an alternative special character. :typoscript:`stdWrap` is - available. Default is "\|" - the vertical line. This sub-property is - useful in cases when the default special character would be recognized - by :ref:`optionsplit` (which takes precedence over :typoscript:`noTrimWrap`). + Wraps content with :typoscript:`
|
` + *if* align is set. - .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page.10.noTrimWrap = | val1 | val2 | + .. _stdwrap-typolink: - In this example the content with the values val1 and val2 will be - wrapped; including the whitespaces. + .. confval:: typolink + :name: stdwrap-typolink + :type: :ref:`typolink` / :ref:`stdWrap` - .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Wraps the content with a link tag. - page.10 { - noTrimWrap = ^ val1 ^ val2 ^ || ^ val3 ^ val4 ^ - noTrimWrap.splitChar = ^ - } - :ref:`optionsplit` will use the "\|\|" to have two subparts in - the first part. In each subpart :typoscript:`noTrimWrap` will then use the "^" as - special character. + .. _stdwrap-wrap: + .. confval:: wrap + :name: stdwrap-wrap + :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` -.. _stdwrap-wrap2: + :typoscript:`splitChar` defines an alternative splitting character (default is "\|" + - the vertical line) -wrap2 -~~~~~ + .. _stdwrap-noTrimWrap: -.. confval:: wrap2 - :name: stdwrap-wrap2 - :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` + .. confval:: noTrimWrap + :name: stdwrap-noTrimWrap + :type: "special" wrap /+.splitChar / :ref:`stdWrap` - same as :ref:`stdwrap-wrap` (but watch the order in which they are executed) + This wraps the content *without* trimming the values. That means that + surrounding whitespaces stay included! Note that this kind of wrap + does not only need a special character in the middle, but that it also + needs the same special character to begin and end the wrap (default + for all three is "\|"). + **Additional property:** -.. _stdwrap-dataWrap: + :typoscript:`splitChar` -dataWrap -~~~~~~~~ + Can be set to define an alternative special character. :typoscript:`stdWrap` is + available. Default is "\|" - the vertical line. This sub-property is + useful in cases when the default special character would be recognized + by :ref:`optionsplit` (which takes precedence over :typoscript:`noTrimWrap`). -.. confval:: dataWrap - :name: stdwrap-dataWrap - :type: mixed / :ref:`stdWrap` + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - The content is parsed for pairs of curly braces. The content of the - curly braces is of the type :ref:`data-type-gettext` and is substituted with the result - of :ref:`data-type-gettext`. + page.10.noTrimWrap = | val1 | val2 | - .. rubric:: Examples + In this example the content with the values val1 and val2 will be + wrapped; including the whitespaces. - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - page.10.dataWrap =
|
+ page.10 { + noTrimWrap = ^ val1 ^ val2 ^ || ^ val3 ^ val4 ^ + noTrimWrap.splitChar = ^ + } - This will produce a :html:`
` tag around the content with an id attribute - that contains the number of the current page. + :ref:`optionsplit` will use the "\|\|" to have two subparts in + the first part. In each subpart :typoscript:`noTrimWrap` will then use the "^" as + special character. -.. _stdwrap-prepend: + .. _stdwrap-wrap2: -prepend -~~~~~~~ + .. confval:: wrap2 + :name: stdwrap-wrap2 + :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` -.. confval:: prepend - :name: stdwrap-prepend - :type: :ref:`data-type-cobject` + same as :ref:`stdwrap-wrap` (but watch the order in which they are executed) - :ref:`stdwrap-cObject` prepended to content (before) + .. _stdwrap-dataWrap: -.. _stdwrap-append: + .. confval:: dataWrap + :name: stdwrap-dataWrap + :type: mixed / :ref:`stdWrap` -append -~~~~~~ + The content is parsed for pairs of curly braces. The content of the + curly braces is of the type :ref:`data-type-gettext` and is substituted with the result + of :ref:`data-type-gettext`. -.. confval:: append - :name: stdwrap-append - :type: :ref:`data-type-cobject` + .. rubric:: Examples - :ref:`stdwrap-cObject` appended to content (after) + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + page.10.dataWrap =
|
-.. _stdwrap-wrap3: + This will produce a :html:`
` tag around the content with an id attribute + that contains the number of the current page. -wrap3 -~~~~~ -.. confval:: wrap3 - :name: stdwrap-wrap3 - :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` + .. _stdwrap-prepend: - same as :typoscript:`wrap` (but watch the order in which they are executed) + .. confval:: prepend + :name: stdwrap-prepend + :type: :ref:`data-type-cobject` + :ref:`stdwrap-cObject` prepended to content (before) -.. _stdwrap-orderedStdWrap: -orderedStdWrap -~~~~~~~~~~~~~~ + .. _stdwrap-append: -.. confval:: orderedStdWrap - :name: stdwrap-orderedStdWrap - :type: Array of numeric keys with / :ref:`stdWrap` each + .. confval:: append + :name: stdwrap-append + :type: :ref:`data-type-cobject` - Execute multiple :typoscript:`stdWrap` statements in a freely selectable order. The order - is determined by the numeric order of the keys. This allows to use multiple - stdWrap statements without having to remember the rather complex sorting - order in which the :typoscript:`stdWrap` functions are executed. + :ref:`stdwrap-cObject` appended to content (after) - .. rubric:: Examples - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. _stdwrap-wrap3: - 10 = TEXT - 10.value = a - 10.stdWrap.orderedStdWrap { - 30.wrap = |. + .. confval:: wrap3 + :name: stdwrap-wrap3 + :type: :ref:`wrap ` /+.splitChar / :ref:`stdWrap` - 10.wrap = is | working - 10.innerWrap =  |  + same as :typoscript:`wrap` (but watch the order in which they are executed) - 20.wrap = This|solution - 20.stdWrap.wrap =  |  - } - In this example orderedStdWrap is executed on the value "a". - :typoscript:`10.innerWrap` is executed first, followed by :typoscript:`10.wrap`. - Then the next key is processed which is 20. Afterwards :typoscript:`30.wrap` - is executed on what already was created. + .. _stdwrap-orderedStdWrap: - This results in "This is a working solution." + .. confval:: orderedStdWrap + :name: stdwrap-orderedStdWrap + :type: Array of numeric keys with / :ref:`stdWrap` each + Execute multiple :typoscript:`stdWrap` statements in a freely selectable order. The order + is determined by the numeric order of the keys. This allows to use multiple + stdWrap statements without having to remember the rather complex sorting + order in which the :typoscript:`stdWrap` functions are executed. -.. _stdwrap-outerWrap: + .. rubric:: Examples -outerWrap -~~~~~~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: outerWrap - :name: stdwrap-outerWrap - :type: :ref:`wrap ` / :ref:`stdWrap` + 10 = TEXT + 10.value = a + 10.stdWrap.orderedStdWrap { + 30.wrap = |. - Wraps the complete content + 10.wrap = is | working + 10.innerWrap =  |  + 20.wrap = This|solution + 20.stdWrap.wrap =  |  + } -.. _stdwrap-insertData: + In this example orderedStdWrap is executed on the value "a". + :typoscript:`10.innerWrap` is executed first, followed by :typoscript:`10.wrap`. + Then the next key is processed which is 20. Afterwards :typoscript:`30.wrap` + is executed on what already was created. -insertData -~~~~~~~~~~ + This results in "This is a working solution." -.. confval:: insertData - :name: stdwrap-insertData - :type: :ref:`data-type-boolean` / :ref:`stdWrap` - If set, then the content string is parsed like :typoscript:`dataWrap` above. + .. _stdwrap-outerWrap: - .. rubric:: Examples + .. confval:: outerWrap + :name: stdwrap-outerWrap + :type: :ref:`wrap ` / :ref:`stdWrap` - Displays the page title: + Wraps the complete content - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - 10 = TEXT - 10.value = This is the page title: {page:title} - 10.stdWrap.insertData = 1 + .. _stdwrap-insertData: - # TEXT is already stdWrapable, so we can also use insertData right away - 20 = TEXT - 20.value = - 20.insertData = 1 + .. confval:: insertData + :name: stdwrap-insertData + :type: :ref:`data-type-boolean` / :ref:`stdWrap` -.. warning:: - Never use this on content that can be edited in the backend. This allows editors to disclose - normally hidden information. Never use this to insert data into wraps. - Use :ref:`stdwrap-dataWrap` instead. + If set, then the content string is parsed like :typoscript:`dataWrap` above. + .. rubric:: Examples -.. _stdwrap-postUserFunc: + Displays the page title: -postUserFunc -~~~~~~~~~~~~ + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. confval:: postUserFunc - :name: stdwrap-postUserFunc - :type: :ref:`data-type-function-name` + 10 = TEXT + 10.value = This is the page title: {page:title} + 10.stdWrap.insertData = 1 - Calls the provided PHP function. If you specify the name with a '->' - in it, then it is interpreted as a call to a method in a class. + # TEXT is already stdWrapable, so we can also use insertData right away + 20 = TEXT + 20.value = + 20.insertData = 1 - Two parameters are sent to the PHP function: As first parameter a - content variable, which contains the current content. This is the - value to be processed. As second parameter any sub-properties of - :typoscript:`postUserFunc` are provided to the function. + .. warning:: + Never use this on content that can be edited in the backend. This allows editors to disclose + normally hidden information. Never use this to insert data into wraps. + Use :ref:`stdwrap-dataWrap` instead. - The description of the :typoscript:`cObject` :ref:`USER ` contains some - more in-depth information. - .. rubric:: Examples + .. _stdwrap-postUserFunc: - You can paste this example directly into a new template record: + .. confval:: postUserFunc + :name: stdwrap-postUserFunc + :type: :ref:`data-type-function-name` - .. literalinclude:: _StdWrap/_UserFunction.typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Calls the provided PHP function. If you specify the name with a '->' + in it, then it is interpreted as a call to a method in a class. - Your methods will get the parameters :php:`$content` and :php:`$conf` - (in that order) and need to return a string. + Two parameters are sent to the PHP function: As first parameter a + content variable, which contains the current content. This is the + value to be processed. As second parameter any sub-properties of + :typoscript:`postUserFunc` are provided to the function. - .. literalinclude:: _StdWrap/_UserFunction.php - :caption: EXT:site_package/Classes/UserFunctions/YourClass.php + The description of the :typoscript:`cObject` :ref:`USER ` contains some + more in-depth information. - For :typoscript:`page.10` the content, which is present when - :typoscript:`postUserFunc` is executed, will be given to the PHP function - :php:`reverseString()`. The result will be `!DLROW OLLEH`. + .. rubric:: Examples - The content of :typoscript:`page.20` will be processed by the function - :php:`reverseString()` from the class :php:`YourClass`. This also returns - the text `!DLROW OLLEH`, but wrapped into a link to the page with the ID 11. - The result will be :html:`!DLROW OLLEH`. + You can paste this example directly into a new template record: - Note how in the second example :php:`$this->cObj`, the reference to the - calling :typoscript:`cObject`, is utilised to use functions from - :php:`ContentObjectRenderer` class! + .. literalinclude:: _StdWrap/_UserFunction.typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Your methods will get the parameters :php:`$content` and :php:`$conf` + (in that order) and need to return a string. -.. _stdwrap-postUserFuncInt: + .. literalinclude:: _StdWrap/_UserFunction.php + :caption: EXT:site_package/Classes/UserFunctions/YourClass.php -postUserFuncInt -~~~~~~~~~~~~~~~ + For :typoscript:`page.10` the content, which is present when + :typoscript:`postUserFunc` is executed, will be given to the PHP function + :php:`reverseString()`. The result will be `!DLROW OLLEH`. -.. confval:: postUserFuncInt - :name: stdwrap-postUserFuncInt - :type: :ref:`data-type-function-name` + The content of :typoscript:`page.20` will be processed by the function + :php:`reverseString()` from the class :php:`YourClass`. This also returns + the text `!DLROW OLLEH`, but wrapped into a link to the page with the ID 11. + The result will be :html:`!DLROW OLLEH`. - Calls the provided PHP function. If you specify the name with a '->' - in it, then it is interpreted as a call to a method in a class. + Note how in the second example :php:`$this->cObj`, the reference to the + calling :typoscript:`cObject`, is utilised to use functions from + :php:`ContentObjectRenderer` class! - Two parameters are sent to the PHP function: As first parameter a - content variable, which contains the current content. This is the - value to be processed. As second parameter any sub-properties of - postUserFuncInt are provided to the function. - The result will be rendered non-cached, outside the main - page-rendering. Please see the description of the :typoscript:`cObject` - :ref:`USER_INT `. + .. _stdwrap-postUserFuncInt: - Supplied by Jens Ellerbrock + .. confval:: postUserFuncInt + :name: stdwrap-postUserFuncInt + :type: :ref:`data-type-function-name` + Calls the provided PHP function. If you specify the name with a '->' + in it, then it is interpreted as a call to a method in a class. -.. _stdwrap-prefixComment: + Two parameters are sent to the PHP function: As first parameter a + content variable, which contains the current content. This is the + value to be processed. As second parameter any sub-properties of + postUserFuncInt are provided to the function. -prefixComment -~~~~~~~~~~~~~ + The result will be rendered non-cached, outside the main + page-rendering. Please see the description of the :typoscript:`cObject` + :ref:`USER_INT `. -.. confval:: prefixComment - :name: stdwrap-prefixComment - :type: :ref:`data-type-string` / :ref:`stdWrap` + Supplied by Jens Ellerbrock - Prefixes content with an HTML comment with the second part of input - string (divided by "\|") where first part is an integer telling how - many trailing tabs to put before the comment on a new line. - The content is parsed through :ref:`stdwrap-insertData`. + .. _stdwrap-prefixComment: - .. rubric:: Examples + .. confval:: prefixComment + :name: stdwrap-prefixComment + :type: :ref:`data-type-string` / :ref:`stdWrap` - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + Prefixes content with an HTML comment with the second part of input + string (divided by "\|") where first part is an integer telling how + many trailing tabs to put before the comment on a new line. - prefixComment = 2 | CONTENT ELEMENT, uid:{field:uid}/{field:CType} + The content is parsed through :ref:`stdwrap-insertData`. - Will indent the comment with 1 tab (and the next line with 2+1 tabs) + .. rubric:: Examples + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript -.. _stdwrap-htmlSanitize: + prefixComment = 2 | CONTENT ELEMENT, uid:{field:uid}/{field:CType} -htmlSanitize -~~~~~~~~~~~~ + Will indent the comment with 1 tab (and the next line with 2+1 tabs) -.. confval:: htmlSanitize - :name: stdwrap-htmlSanitize - :type: :ref:`data-type-boolean` / array with key "build" - The property controls the sanitization and removal of XSS from markup. It - strips tags, attributes and values that are not explicitly allowed. +.. _stdwrap-properties-cache: - * :typoscript:`htmlSanitize = [boolean]`: whether to invoke sanitization - (enabled per default when invoked via :typoscript:`stdWrap.parseFunc`). - * :typoscript:`htmlSanitize.build = [string]`: defines which specific builder - (must be an instance of :php:`\TYPO3\HtmlSanitizer\Builder\BuilderInterface`) - to be used for building a :php:`\TYPO3\HtmlSanitizer\Sanitizer` instance - using a particular :php:`\TYPO3\HtmlSanitizer\Behavior`. This can either be - a fully qualified class name or the name of a preset as defined in - :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['htmlSanitizer']` - per default, - :php:`\TYPO3\CMS\Core\Html\DefaultSanitizerBuilder` is used. +Properties for sanitizing and caching data +------------------------------------------ - .. rubric:: Examples +.. confval-menu:: + :name: stdwrap-cache + :display: table + :type: - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + .. _stdwrap-htmlSanitize: - 10 = TEXT - 10 { - value =
- htmlSanitize = 1 - } + .. confval:: htmlSanitize + :name: stdwrap-htmlSanitize + :type: :ref:`data-type-boolean` / array with key "build" - will result in the following output: + The property controls the sanitization and removal of XSS from markup. It + strips tags, attributes and values that are not explicitly allowed. - .. code-block:: html + * :typoscript:`htmlSanitize = [boolean]`: whether to invoke sanitization + (enabled per default when invoked via :typoscript:`stdWrap.parseFunc`). + * :typoscript:`htmlSanitize.build = [string]`: defines which specific builder + (must be an instance of :php:`\TYPO3\HtmlSanitizer\Builder\BuilderInterface`) + to be used for building a :php:`\TYPO3\HtmlSanitizer\Sanitizer` instance + using a particular :php:`\TYPO3\HtmlSanitizer\Behavior`. This can either be + a fully qualified class name or the name of a preset as defined in + :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['htmlSanitizer']` - per default, + :php:`\TYPO3\CMS\Core\Html\DefaultSanitizerBuilder` is used. -
+ .. rubric:: Examples - The following code is equivalent to above, but with a builder specified: + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript - .. code-block:: typoscript - :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + 10 = TEXT + 10 { + value =
+ htmlSanitize = 1 + } - 10 = TEXT - 10 { - value =
- htmlSanitize = 1 - // Use either "default" for the default builder - htmlSanitize.build = default - // or use the full class name of the default builder - // htmlSanitize.build = TYPO3\CMS\Core\Html\DefaultSanitizerBuilder - } + will result in the following output: + .. code-block:: html -.. _stdwrap-cache: +
-cache -~~~~~ + The following code is equivalent to above, but with a builder specified: + + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript + + 10 = TEXT + 10 { + value =
+ htmlSanitize = 1 + // Use either "default" for the default builder + htmlSanitize.build = default + // or use the full class name of the default builder + // htmlSanitize.build = TYPO3\CMS\Core\Html\DefaultSanitizerBuilder + } -.. confval:: cache - :name: stdwrap-cache - :type: :ref:`cache` - Caches rendered content in the caching framework. + .. _stdwrap-cache: + .. confval:: cache + :name: stdwrap-cache + :type: :ref:`cache` -.. _stdwrap-debug: + Caches rendered content in the caching framework. -debug -~~~~~ +.. _stdwrap-properties-debug: -.. confval:: debug +Properties for debugging data +----------------------------- + +.. confval-menu:: :name: stdwrap-debug - :type: :ref:`data-type-boolean` / :ref:`stdWrap` + :display: table + :type: - Prints content with :php:`HTMLSpecialChars()` and :html:`
`:
-    Useful for debugging which value :typoscript:`stdWrap` actually ends up with,
-    if you are constructing a website with TypoScript.
+    ..  _stdwrap-debug:
 
-.. attention::
+    ..  confval:: debug
+        :name: stdwrap-debug
+        :type: :ref:`data-type-boolean` / :ref:`stdWrap`
 
-   Only for debugging during development, otherwise output can break.
+        Prints content with :php:`HTMLSpecialChars()` and :html:`
`:
+        Useful for debugging which value :typoscript:`stdWrap` actually ends up with,
+        if you are constructing a website with TypoScript.
 
+    .. attention::
 
-..  _stdwrap-debugFunc:
+       Only for debugging during development, otherwise output can break.
 
-debugFunc
-~~~~~~~~~
 
-..  confval:: debugFunc
-    :name: stdwrap-debugFunc
-    :type: :ref:`data-type-boolean` / :ref:`stdWrap`
+    ..  _stdwrap-debugFunc:
 
-    Prints the content directly to browser with the :php:`debug()` function.
+    ..  confval:: debugFunc
+        :name: stdwrap-debugFunc
+        :type: :ref:`data-type-boolean` / :ref:`stdWrap`
 
-    Set to value "2" the content will be printed in a table which looks nicer.
+        Prints the content directly to browser with the :php:`debug()` function.
 
-..  attention::
+        Set to value "2" the content will be printed in a table which looks nicer.
 
-    Only for debugging during development, otherwise output can break.
+    ..  attention::
 
+        Only for debugging during development, otherwise output can break.
 
-..  _stdwrap-debugData:
 
-debugData
-~~~~~~~~~
+    ..  _stdwrap-debugData:
 
-..  confval:: debugData
-    :name: stdwrap-debugData
-    :type: :ref:`data-type-boolean` / :ref:`stdWrap`
+    ..  confval:: debugData
+        :name: stdwrap-debugData
+        :type: :ref:`data-type-boolean` / :ref:`stdWrap`
 
-    Prints the current data-array, :php:`$cObj->data`, directly to browser. This
-    is where :typoscript:`field` gets data from.
+        Prints the current data-array, :php:`$cObj->data`, directly to browser. This
+        is where :typoscript:`field` gets data from.
 
-..  attention::
+    ..  attention::
 
-    Only for debugging during development, otherwise output can break.
+        Only for debugging during development, otherwise output can break.
 
 .. _stdwrap-examples: