Adding configuration fields to a typo3 page with fluid / flux

与世无争的帅哥 提交于 2019-12-02 04:02:26

I am afraid, you mix things up a bit.

flux, fluidcontent and (especially important for you) fluidpages play together to extend the default capabilities of creating fluid templates for TYPO3.

  • flux Is the base technology for parsing and reconstituting TYPO3 form fields.
  • fluidcontent utilizes flux to allow Flexible Content Elements
  • fluidpages utilizes flux to allow Page Layouts in pure fluid with custom fields

To summarize: You have read a tutorial concerning basic fluid page templating, but not fluidpages templating. To get you started quickly, there are some examples and documentation resources available:

  • The quickstart from the documentation repository
  • The speciality provider extension from the bootstrap package (please use with caution-this is an example, not your next project template)
  • the extensions fluidcontent_bootstrap and fluidpages_bootstrap

When you are through those resources, you know how to register a provider extension, so that you can select it in the page properties in the backend.

Your template might look something like this (it's actually taken from the aforementioned speciality extension):

 <!-- Note that the namespace declaration depends on which version of flux you are actually using -->
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
<f:layout name="Page"/>
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
     xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
     xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
     xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">

    <f:section name="Configuration">

        <flux:form id="1column" label="1 column layout">

            <!-- Options visible in page property -->
            <flux:field.input name="settings.carousel.categories" eval="trim" default="4" />
            <flux:field.input name="settings.carousel.width" eval="trim" default="1200"/>
            <flux:field.input name="settings.carousel.height" eval="trim" default="340"/>
            <flux:field.checkbox name="settings.carousel.caption" default="1"/>

            <!-- Grid displayed in the page module -->
            <flux:grid>
                <flux:grid.row>
                    <flux:grid.column colPos="0" label="Main Content"/>
                </flux:grid.row>
            </flux:grid>
        </flux:form>
    </f:section>

    <f:section name="Content">
        <div class="row" role="main">
            <div class="col-md-12" role="section">
                <v:page.content.render column="0"/>
                <f:if condition="{v:var.typoscript(path: 'lib.addthis.display')}">
                    <f:render section="AddThis" partial="AddThis" optional="TRUE" arguments="{_all}"/>
                </f:if>
            </div>
        </div>
    </f:section>

</div>

Most flux templates (regardless wether fluidpages or fluidcontent) are split up into (at least) 3 f:section fluid sections:

  • Configuration takes your form fields
  • Preview influences how your template is being previewed in the backend
  • Usually Content or Main (you can influence the naming, in your Layout files but should stick to the conventions we spread accross the example extensions) renders your FCE/Page template

The field items are usable by accessing them via their name attribute as getter. To illustrate this, you could access {settings.carousel.caption} from inside the page template above.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!