【问题标题】:Adding configuration fields to a typo3 page with fluid / flux使用流体/通量将配置字段添加到typo3页面
【发布时间】:2014-05-02 06:27:01
【问题描述】:

我已经设置了一个站点以使用通量 / FLUIDCONTENT 作为模板,并使用此处的教程使其工作:http://thomas.deuling.org/2011/06/create-base-html-fluid-templates-for-typo3-4-5/

一切正常,但现在我希望能够为每页选择一个图像并使用它来构建一个大标题。使用 templavoila,我可以创建页面属性中可用的字段,但似乎无法使其与 FLUIDCONTENT 一起使用。

我使用的是 Typo3 6.1,这是我的内页 flex 模板:

{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="main" />

<f:section name="content">
                    <f:format.raw>{content_header}</f:format.raw>
    <div id="content">
        <div class="container">
           <div class="row">
                <div class="col-md-3">
                    <f:format.raw>{content_left}</f:format.raw>
                </div>
                <div class="col-md-9">
                    <f:format.raw>{content}</f:format.raw>
                </div>
            </div>
        </div>
    </div>
</f:section>

如何将表单字段添加到页面属性并在我的模板中使用它们?

【问题讨论】:

    标签: typo3 fluid fedext


    【解决方案1】:

    恐怕你把事情搞混了。

    fluxfluidcontent 和(对你来说尤其重要)fluidpages 一起扩展为 TYPO3 创建 fluid 模板的默认功能。

    • flux 是解析和重构 TYPO3 表单字段的基础技术。
    • fluidcontent 利用通量来实现灵活的内容元素
    • fluidpages 利用通量来允许在具有自定义字段的纯流体中进行页面布局

    总结一下:您已经阅读了有关基本fluid 页面模板的教程,但没有阅读fluidpages 模板。为了让您快速入门,我们提供了一些示例和文档资源:

    • 来自文档存储库的quickstart
    • 引导程序包中的speciality provider extension(请谨慎使用 - 这是一个示例,不是您的下一个项目模板)
    • 扩展名fluidcontent_bootstrapfluidpages_bootstrap

    当你通过这些资源,你知道如何注册一个提供者扩展,以便你可以在后端的页面属性中选择它。

    您的模板可能看起来像这样(它实际上取自上述专业扩展):

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

    大多数通量模板(无论是流体页面还是流体内容)都分为(至少)3 个f:section 流体部分:

    • 配置获取您的表单字段
    • 预览会影响您的模板在后端的预览方式
    • 通常 ContentMain(您可以在布局文件中影响命名,但应遵守我们在示例扩展中传播的约定)呈现您的 FCE/页面模板

    field 项目可以通过 name 属性作为 getter 访问它们来使用。为了说明这一点,您可以从上面的页面模板中访问{settings.carousel.caption}

    【讨论】:

    • 感谢您提供彻底而清晰的答案,我想我对所有不同的术语都感到有些困惑。我明天会去设置一个流体页面模板。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-08
    • 1970-01-01
    • 2017-04-28
    • 2017-07-14
    • 1970-01-01
    相关资源
    最近更新 更多