Search code examples
typo3fluidflux

fluid powered TYPO3 - the right settings for namespaces


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?


Solution

  • 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" />
    

    http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Templating.html#namespaces

    For TYPO3 CMS, the resolution is the following.

    1. Check settings.namespaces.http://example\.org/url = className, if match, use this
    2. Check if the url starts with http://typo3.org.ns/, then everything after it will be interpreted as class name
    3. Ignore it otherwise

    Fore 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.