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?
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.
Check settings.namespaces.http://example\.org/url = className, if match, use this
Check if the url starts with http://typo3.org.ns/, then everything after it will be interpreted as class name
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.
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>
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>
Related
I'm working on a content element created with flux. Editors using this element can use some markers in some fields (e.g. ###region###). Therefore I would like to give information about the markers that can be used.
I checked CSH and the Flux documentation but couldn't find any solution. Does someone have an idea how to solve this?
My code:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Content"/>
<f:section name="Configuration">
<flux:form id="tt-teaser">
<flux:field.input label="Stoerer" name="stoerer"/>
<flux:field.input label="Title" name="title"/>
<flux:field.text label="Text" name="text" enableRichText="1"/>
<flux:field.input label="Button Text" name="buttonText"/>
</flux:form>
</f:section>
I'm using TYPO3 v10.4.13 and Flux v9.4.2.
You can add LL references for TCA descriptions, the tx_news extension uses this approach as well.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tt_content.pi_flexform.[extkey-with-no-lower-dash]_[CE-name]', 'EXT:your_ext/Resources/Private/Language/locallang_csh.xlf');.
As you can see you have to add this for each CE, also the id in the language file is "[field-ID].description".
I'm using Typo3 7.6.4 and I want to wrap an extension output with a div.
The extension is csv-table.
How can I do this with Typoscript?
Most plug-ins are defined as a USER or USER_INT objects. These have a property stdWrap See TypoScript Reference - USER(_INT)
I couldn't find the extension 'csv-table' for TYPO3 7, but let's assume that it's available in TypoScript as plugin.tx_csvtable_pi1 then you could use something like:
plugin.tx_csvtable_pi1.stdWrap.wrap = <div class="myCsvTable">|</div>
The best way is to use a fluid layout if you use EXT:fluid_styled_content
Resources/Private/Templates/CsvTable.html
<f:layout name="Default" />
<f:section name="Main">
my output
</f:section>
Resources/Private/Layouts/Default.html
<div class="my-element">
<f:render section="Main" />
</div>
TypoScript reference: FLUIDTEMPLATE
If you use the old css_styled_content you can use this
tt_content.my_ext = COA
tt_content.my_ext.stdWrap.wrap = <div>|</div>
I try to output 1 random image with VHS (version 2.4.0) RandomViewHelper v:iterator.random.
This is my code:
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="random-image" label="Random Image" options="{icon: 'Icons/Content/Example.gif', group: 'Joya'}">
<flux:field.input name="classname" label="Classname" />
</flux:form>
<flux:form.section name="images" label="Images">
<flux:form.object name="image" label="Image">
<flux:field.file name="imagesrc" label="Image" allowed="png,jpg" maxItems="1" size="1" />
</flux:form.object>
</flux:form.section>
</f:section>
<f:section name="Preview">
Random Image
</f:section>
<f:section name="Main">
<div class="random-image">
<v:iterator.random as="img" subject="{images}">
{img.image.imagesrc}
</v:iterator.random>
</div>
</f:section>
I added 3 images to test, but it always outputs the same image.
Edit: the output of random is cached. So it outputs another image after the cache is cleared.
Can I disable the cache just for this line of code?
https://fluidtypo3.org/viewhelpers/vhs/2.4.0/Iterator/RandomViewHelper.html
The solution is to use the VHS ViewHelper v:render.uncache and creatre a partial with the part that shall not be cached. Its not the best solution as you need an extra file. But right now the only other way I can think of is to use some Typoscript, and thats also something I want to avoid.
Another approach is to load the image true an ajax call, this way you can cache the page, but not the random image.
Fluid Styled Content uses the f:render Viewhelper as such:
<f:render partial="Header" arguments="{_all}" />
I'd like to pass another info to the partial, like
<f:render partial="Header" arguments="{_all, settings : doThis}" />
But it seems to me that's the wrong way, as it throws an error.
I also tried accessing settings.doThis with f:alias, but no luck (or rather, skill) either.
How's that done correctly?
This is possible with the alias ViewHelper. I already used it with TYPO3 version 6 and 7.
Just extend the {_all} var as following
Partial
<f:alias map="{additionalVar: 'foobar'}">
<f:render partial="Partial" arguments="{_all}"/>
</f:alias>
Section
<f:alias map="{additionalVar: 'foobar'}">
<f:render section="Section" arguments="{_all}" />
</f:alias>
You can use the "additionalVar" variable as any other.
It is working with section and partial.
You can't, so just modify your settings (or any other var) in the controller yet or use ViewHelper, which allows you to declare vars in the view, like i.e.: v:variable.set of VHS ext.
It is possible to use this one, but donĀ“t use the var 'settings'. This one is used by typoscript.
<f:render partial="Header" arguments="{_all, myvar:'myvalue'}" />
Try the <f:debug> tag in the Header Partial and see
You can use vhs viewhelper with fluid like below.
<v:variable.set value="{yourValue}" name="variable">
<f:render partial="Header" arguments="{_all, newVar:variable}" />
How can I use a typolink-field at my FLUX Flexform-Configuration (Backend)
<f:section name="Configuration">
<flux:form id="home" options="{icon: 'Icons/Content/myicon.gif', group: 'Homepage'}">
<flux:field.input name="txtHeadline" label="Headline" />
<!-- ?? -->
<flux:field.input name="lnkTarget" label="Link">
<flux:wizard.link />
</flux:field.input>
</flux:form>
</f:section>
Main Section:
{namespace v=Tx_Vhs_ViewHelpers}
...
<v:link.typolink parameter="{parameter: section.item.url}">Beautiful link</v:link.typolink>
<!-- or -->
<v:uri.typolink parameter="{parameter: section.item.url}" />
That's my first steps with FLUID Powered TYPO3 and I have no idea?
Thanks for your help. I need this input field and the link wizard for the 'normal' output: <a href="mylink" class="xy" />
Jost is right. You need to pass the value from the field to the TypoLink ViewHelper from VHS.
Being partially compatible with the TYPO3 CMS Core typolink function, you need to pass your field value as parameter.
Having a form field like:
<flux:field.input name="lnkTarget" label="Link">
<flux:wizard.link />
</flux:field.input>
Example with the plain contents of a field:
<v:link.typolink configuration="{parameter: lnkTarget}" />
Example with custom overrides/additions to the field value:
<v:link.typolink configuration="{parameter: lnkTarget, additionalParams: '&print=1', title: 'Follow the link'}">
Click Me!
</v:link.typolink>
Notice where I placed {lnkTarget}.
You can look those up in the DocComent Block on the ViewHelpers:
https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Link/TypolinkViewHelper.php#L22
https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Uri/TypolinkViewHelper.php#L22
Being one of the maintainers, if you need further feedback-please raise an issue on the Github project if you have problems using it or join us on IRC (#fedext on Freenode)
Now in 2021 (Typo3 10) use:
<flux:field.input name="linktarget" label="Link" config="{renderType: 'inputLink'}"></flux:field.input>
And
<f:link.typolink parameter="{parameter: d.job.linktarget}">Click Me!</f:link.typolink>