Inserting news teaser inside FalMediaContainer template - typo3

Is it possible to insert {newsItem.teaser} into FalMediaContainer.html? Do I need to insert something more to fluid template to see on output news teaser?
Thanks for any help

This is of course possible, however you need to change the Detail.html as well.
Please change the line
<f:render partial="Detail/FalMediaContainer" arguments="{media: newsItem.falMedia, settings:settings}" />
into
<f:render partial="Detail/FalMediaContainer" arguments="{newsItem:newsItem, media: newsItem.falMedia, settings:settings}" />
afterwards you can use any property of the {newsItem}also in the partial!

Related

Dynamic UID to edit the current news item

I use "Frontend_Editing" extension on TYPO3, to edit News items from Frontend.
How can i edit this code to change uid with the value of the current News item :
<core:contentEditable table="tx_news_domain_model_news" uid="9">
<f:render section="content" />
</core:contentEditable>
Did you have a look at the documentation of EXT:frontend_editing?
A full example for inline editing of a certain field looks like this:
<core:contentEditable table="{item.table}" field="{item.field}" uid="{item.uid}">
{item.bodytext}
</core:contentEditable>
I found the solution uid="{item.uid}" need to be uid="{newsItem.uid}"
So the code is :
<core:contentEditable table="tx_news_domain_model_news" uid="{newsItem.uid}">
<f:render section="content" />
</core:contentEditable>

TYPO3 Flux - getting content of grid returns nothing

I have a flux-grid that looks like this:
<flux:grid>
<flux:grid.row>
<flux:grid.column name="content" label="Content"/>
</flux:grid.row>
</flux:grid>
It's a wrapper for other content-elements (namely elements of a slider).
Now I need to wrap each of the elements in a <li>-Tag.
So I thought I get the content as an array and render it in an each-loop.
<flux:content.render area="content" as="slides" render="1" />
I thought I'd have the elements in a variable called slides now. But that doesn't seem to be the case. When I use <f:debug>{slides}</f:debug> I get just an empty variable...
Thus, this fails:
<f:for each="{slides}" as="slide">
<f:debug>{slide}</f:debug>
</f:for>
Just outputting the content like this works, though:
<flux:content.render area="content"/>
What am I doing wrong?
[Edit]
I'm one step further...
<v:variable.set name="contentElements" value="{flux:content.get(area:'content', render:'FALSE')}" />
Does indeed return an array with the elements.
But when I try to render the elements, they're empty:
<f:for each="{contentElements}" as="contentElement">
UID: {contentElement.uid}<br />
<v:content.render contentUids="{0:contentElement.uid}" />
</f:for>
the UID is correctly outputted - the v:content.render fails
Seems like I was just using an old Vhs-Version.
Saw in the Extensions that it had an update (to 4.3.3) and now it's working...

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

Access flux fields from another Fluidtypo3 FCE element (flux, fluidcontent, vhs)

I'm trying to access the settings of a Fluidtypo3 FCE element. My FCE is a news article that I want to include in another FCE, which is a slider. The slider only has one field and the configuration is the following:
<flux:field.relation
name="articles"
label="News-Beitrag"
multiple="true"
size="6"
table="tt_content"
condition="AND tt_content.pid = {record.pid} AND CType = 'fluidcontent_content' AND colPos = 1 AND sys_language_uid = {record.sys_language_uid}"
minItems="1"
maxItems="10"
renderMode="default"
/>
This configuration works, I can select all my news FCE's as a relation. The field articles saves the uid's of all referenced FCE's. Now I am trying to use these uid's to receive the content. Right now my code is the following:
<f:section name="Main">
<f:if condition="{articles}">
{v:iterator.explode(content: '{articles}', glue: ",", as: 'articles')}
{v:content.get(contentUids: "{articles}", render: 0) -> v:variable.set(name: 'slides')}
<f:for each="{slides}" as="element">
</f:for>
</f:if>
</f:section>
The <v:content.get> ViewHelper gets the tt_content record as it is recorded in the database. The flux settings are stored in XML-Format in the field pi_flexform. I am trying to access those specific flux settings one by one and not just the whole pi_flexform field in xml format.
I've looked for ViewHelpers that can convert XML to an Array and tried many other things, but nothing worked for me. I am grateful for any ideas how to solve this problem.
<flux:form.data> is the Viewhelper you seek. You can use it like this:
<f:for each="{slides}" as="element">
<flux:form.data table="tt_content" field="pi_flexform" record="{element}" as="flexformData">
<!-- Do stuff with flexformData -->
</flux:form.data>
</f:for>

Use v:content.render in a Contentelement

I try to render some Elements from another page via fluid in a Partial and try to use v:content.render. As you can see in the code I want to render 3 elements from the page with the Uid 9. But as soon as I have the v:content.render element in it I just get a blank page.
So my question is how to use v:content.render or what alternative I have? Or do I still need to use Typoscript for that?
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<div class="footer2">
<v:content.render column="0" limit="3" pageUid="9" as="contentElements">
<f:for each="{contentElements}" as="contentElement" iteration="footerIteration">
<f:format.html>{contentElement.bodytext}</f:format.html>
</f:for>
</v:content.render>
</div>
I am not sure if it is important, but the elements on the Page 9 are also fluid content elements.
I found a solution that works:
<v:variable.set name="contentElements" value="{v:content.get(column:'0', limit:'3', pageUid:'9', render:'FALSE')}" />
<f:for each="{contentElements}" as="contentElement" iteration="footerIteration">
<v:content.render contentUids="{0:contentElement.uid}" />
<f:format.html>{contentElement.bodytext}</f:format.html>
</f:for>
I think your first attempt was more readable. {contentElement} already had what you needed, there is no property bodytext if you leave render to its default true.
<v:content.render column="0" pageUid="9" limit:"3" as="contentElements">
<f:for each="{contentElements}" as="contentElement">
<f:format.raw>{contentElement}</f:format.raw>
</f:for>
</v:content.render>
If you don't know what you get back in as="" to work with, just try a debug:
<v:content.render column="0" pageUid="9" limit:"3" as="contentElements">
<f:for each="{contentElements}" as="contentElement">
<f:debug inline="true">{contentElement}</f:debug>
</f:for>
</v:content.render>
And I replaced <f:format.html> with <f:format.raw> so prevent some unwanted <p></p>