[FEATURE] Remove ViewHelper xmlns-attributes and specified html tag
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-66269-FluidRemoveViewHelperXmlnsAttributesAndSpecifiedHtmlTag.rst
1 ==================================================================================
2 Feature - #66269: Fluid: Remove ViewHelper xmlns-attributes and specified html tag
3 ==================================================================================
4
5 Description
6 ===========
7
8 With the introduction of using xmlns:* attributes to include ViewHelpers, it is possible to have IDE support for Fluid templates.
9 However, the problem is that the xmlns:* attributes and the corresponding tag will also be rendered, which is not desired
10 most of the time. A workaround, to avoid this is, is to use sections.
11 However, this solution is counter-intuitive, is not available in layouts and causes extra processing overhead.
12
13 .. code-block:: html
14
15 <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
16 xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers">
17
18 <f:section name="content">
19 </f:section>
20
21
22 Impact
23 ======
24
25 The xmlns:* attributes for valid ViewHelper namespaces will now be removed before rendering.
26 Such ViewHelper namespaces follow this URI pattern:
27
28 .. code-block:: html
29
30 http://typo3.org/ns/<phpNamespace>
31
32
33 Examples:
34
35 .. code-block:: html
36
37 http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers
38 http://typo3.org/ns/GeorgRinger/News/ViewHelpers
39
40
41 xmlns attributes for non-ViewHelper namespaces will be preserved.
42
43 Furthermore an additional data-attribute to HTML-Tags is introduced.
44
45 .. code-block:: html
46
47 data-namespace-typo3-fluid="true"
48
49 If this attribute is specified on the HTML-Tag, the HTML-tag itself won't be rendered as well.
50 (Also a corresponding closing tag will not be rendered for that template.)
51 This is useful for various IDEs and HTML autocompletion.
52
53
54 Examples
55 ========
56
57 Include ViewHelper namespaces on an existing tag (e.g. root xml tag) via xmlns attributes for Fluid and News extension.
58
59 .. code-block:: xml
60
61 <?xml version="1.0" encoding="utf-8"?>
62 <root xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
63 xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers"
64 xmlns:foo="http://typo3.org/foo">
65
66 <f:if condition="{newsItem.title}">
67 <f:then>
68 <n:titleTag>{newsItem.title}</n:titleTag>
69 </f:then>
70 <f:else>
71 <n:titleTag>News-Detail</n:titleTag>
72 </f:else>
73 </f:if>
74 </root>
75
76 Output is then
77
78 .. code-block:: xml
79
80 <root xmlns:foo="http://typo3.org/foo" >
81 ...
82 </root>
83
84
85 Include ViewHelper namespaces with HTML-tag and a data-namespace-typo3-fluid="true" attribute via xmlns attributes for Fluid and News extension.
86
87 .. code-block:: html
88
89 <html data-namespace-typo3-fluid="true"
90 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
91 xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers">
92
93 <f:if condition="{newsItem.title}">
94 <f:then>
95 <n:titleTag>{newsItem.title}</n:titleTag>
96 </f:then>
97 <f:else>
98 <n:titleTag>News-Detail</n:titleTag>
99 </f:else>
100 </f:if>
101 </html>
102
103 The output contains everything excluding the HTML-tag.