wrap extension output with typoscript typo3 is not working - typo3

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>

Related

Add Lib Content to Main Section TYPO3 6.2 Typoscript

can someone help me adding a lib to the main section of the page via typoscript
TS:
[globalVar = TSFE:id = 314]
includeLibs.voucher = fileadmin/php/shop_init.php
lib.phpscript = USER
lib.phpscript.userFunc = voucher->init
[global]
Template:
<div class="main-section">
<f:render section="Main" />
<f:cObject typoscriptObjectPath="lib.phpscript" />
</div>
Now the content is showing after the Main section but i need it in the main section :/
What is the ts code for this??
THX in advance!
You have to add
<f:cObject typoscriptObjectPath="lib.phpscript" />
in a template between the tags
<f:section name="main"></f:section>
You can find the templates in the folder:
your_extension\Resources\Private\Templates\

How can I extract metadata properties from images with FAL and fluid?

Situation
sysext:filemetadata is activated; images (fal references) are deposited within page resources (pages.media).
2 options are currently known to me in conjunction to TYPO3 pages:
Using a custom FAL viewhelper
Using TypoScript (which is often illegible and not easy to maintain)
Question
What's actually (TYPO3 7.x and 8.x) a common/core-only solution to render such images within fluid with additional properties (metadata) like creator, copyright and so on?
I would go for next approach:
typoscript
page.10 = FLUIDTEMPLATE
page.10 {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
}
...
}
fluid
<f:for each="{files}" as="file">
<div class="media">
<figure>
<f:media file="{file}" />
<figcaption>
{file.description}<br />
author: {file.properties.creator}<br />
copyright: {file.properties.copyright}
</figcaption>
</figure>
</div>
</f:for>
...
To find all possible sys_file_reference and sys_file_metadata properties just add <f:debug>{file.properties}</f:debug> inside the <f:for ...</f:for>.

In TYPO3 Fluid, how to pass additional arguments to a partial when {_all} is used

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 to include a constant in a TYPO3 Fluid VHS menu

I have a simple menu generated by the Fluid Menu ViewHelper:
<v:page.menu useShortcutData="TRUE" levels="3" expandAll="1" class="menu" classActive="act" substElementUid="1" excludePages="12,13,3" />
There are multiple languages and each language has different pages hidden in the navigation that I would like to change in the "excludePages" part.
In Typoscript I would simply use a constants marker like {$exclude}. Adding the marker in fluid breaks the menu. What would be the way to achieve this in an inline Fluid setup like this?
There are different ways to get constant into Fluid.
1. Include form TypoScript
{f:cObject(typoscriptObjectPath: 'lib.myConstant')}
2. Save in settings from your ext.
plugin.tx_myext.settings {
myonstant = TEXT
myconstant = 1,2,3
}
3. Configuration in Page Template (the pure fluid way)
<f:section name="Configuration">
<flux:form id="mypage" options="{icon: 'Icons/Page/Standard.gif'}">
<flux:field.tree name="myConstantFromTRee" table="pages" parentField="pid" expandAll="0" multiple="1" minItems="0" maxItems="0" label="myConstantFromList" foreignLabel="title" size="10"/>
</flux:form>
<flux:grid>
<flux:grid.row>
<flux:grid.column colPos="0" name="main" />
</flux:grid.row>
</flux:grid>
</f:section>
And access it with {settings.myConstantFromTRee}.

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?
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>