[TYPO3-dev] Fluid: Nested content elements for div container?

am at break-media.com am at break-media.com
Sun Jun 14 11:02:48 CEST 2015


Hi Peter,

If you are using fluidpages extension (from FluidTypo3.org), then this is a
quite simple task.
There you can define a backend layout and use the standard page editor from
Typo3
to add several elements inside a wrapping FCE.
(Like it was in TemplaVoila times, but easier and possible to use all in a
VCS).

Docs for that you can find on fluidtypo3.org [1].

Basically you create a simple extension and just add a file there:
typo3conf/ext/[YOUR_EXT]/Resources/Private/Templates/Content/Wrapper.html

There content could be something like that:

<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
    xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
    xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers">

    <f:layout name="Content" />

    <f:section name="Configuration">
        <flux:form id="Wrapper" label="Wrapper" options="{group:
'FCEs'}">
            <!-- grid to insert any other typo3 content in
backend -->
            <flux:grid>
                <flux:grid.row>
                    <flux:grid.column name="content"
label="Content" />
                </flux:grid.row>
            </flux:grid>
            <!-- select box with predefined frame classes -->
            <flux:field.select label="Frame"
name="settings.frame_type" items="frame1,frame2" />
        </flux:form>
    </f:section>

    <!-- used in backend preview -->
    <f:section name="Preview">
        <strong>Wrapper with frame {settings.frame_type}</strong>
        <p>{content}</p>
    </f:section>

    <!-- rendered frontend output -->
    <f:section name="Main">
        <div class="frame {settings.frame_type}">
            <flux:content.render area="content" />
        </div>
    </f:section>
</div>

That's it, now a new content element appears in the backend where you can
insert content elements and select a frame-class with a dropdown.
On frontend you get a div rendered with selected frame-class and content
elements inside rendered.

[1]
https://fluidtypo3.org/documentation/templating-manual/templating/creating-templates/content-element.html

Best regards,

Adrian
BREAK Media Solutions GmbH

Zitat von Robert Peter <peter at melon-media.de>:

> Hey there, I'm using Fluid for creating my template and I'd like to
> wrap a div container around a certain amount of content elements. In
> order to accomplish that I saw that Fluid provides the content
> element tab "Relations". My idea is to add the content elements in
> there as a child and afterwards selecting for this "parent" content
> element a specific frame that does the rest (adding the div
> container).
> How can I achieve this with fluid? Any suggestions?
> Thx!
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev



More information about the TYPO3-dev mailing list