Reputation: 2399
I am using TYPO3 6.2.3, and Extensions from TER: (flux 7.0.0, fludipages 3.0.0, fluidcontent 4.0.0, VHS 1.8.5) What is the right implementation of the namespaces? In the Documentation of fluidtypo3 is it <div
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=Tx_Vhs_ViewHelpers}
xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:flux="http://typo3.org/ns/flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/vhs/ViewHelpers">
On other places it is:
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=Tx_Vhs_ViewHelpers}
<f:layout name="Content" />
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:flux="http://typo3.org/ns/flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
I am also a bit confused if the <f:layout name="Content" />
has to be inside or outside the namespace div?
Upvotes: 3
Views: 6402
Reputation: 327
Q: What is the right implementation of the namespaces?
A: I'm not sure myself. But in the case of vhs viewhelpers, this namespace declaration in a partial works for me (Typo3 6.2.12, vhs 2.3.2)
{namespace v=FluidTYPO3\vhs\ViewHelpers}
Side note
The following namespace declaration will not work, because it is not using the namespace notation (thx @kimomat):
{namespace v=Tx_Vhs_ViewHelpers}
On the other hand, for the namespace of my own viewhelpers, I have to use the above notation and it works
{namespace speciality = Tx_Speciality_ViewHelpers}
For reference, this is my complete partial.html
{namespace v=FluidTYPO3\vhs\ViewHelpers}
<f:if condition="1">
<f:then>SUCCESS</f:then>
<f:else>ERROR</f:else>
</f:if>
Upvotes: 2
Reputation: 4578
There are two ways to define namespaces. The first one is the namespace tag in the fluid custom style notation:
{namespace x=Classname}
The other one is the formal XML notation for namespaces, thus if you use this, it makes your template fully XML compliant.
<someTag xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers" />
For TYPO3 CMS
, the resolution is the following.
settings.namespaces.http://example\.org/url = className
, if match, use thishttp://typo3.org.ns/
, then everything after it will be interpreted as class nameFore more information, please take a look at the samples in typo3/sysext/fluid/Tests/Unit/Core/Parser/TemplateParserTest.php
AFAIK namespaces that are detected and interpreted by fluid, are not printed into the output.
Upvotes: 4
Reputation: 2761
The xmlns-defintions are just for your IDE to get code-completion. Adding it to the div will render it in frontend, I don't think that you want that.
This is my universal template for use in Templates AND Partials.
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<head>
<title>Template: Extension Index</title>
<f:layout name="Default" />
</head>
<body>
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
<f:section name="main">
// Content
<f:render partial="Example/Ex" section="main">
</f:section>
</body>
</html>
Upvotes: 3