使用流体/助熔剂将配置字段添加到typo3页面 [英] Adding configuration fields to a typo3 page with fluid / flux

查看:110
本文介绍了使用流体/助熔剂将配置字段添加到typo3页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个站点,以使用flux/FLUIDCONTENT作为模板,并使用此处的教程进行操作:

I have setup a site to use flux / FLUIDCONTENT for templates and have it working using the tutorial here: http://thomas.deuling.org/2011/06/create-base-html-fluid-templates-for-typo3-4-5/

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

It's all working well but now I want to be able to choose an image per page and use it to build a big header. With templavoila I could create fields that were available in the page properties but can't seem to get it working with FLUIDCONTENT.

我正在使用Typo3 6.1,这是我的内页Flex模板:

I am using Typo3 6.1 and here is my inside page flex template:

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

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

推荐答案

恐怕您会把事情混在一起.

I am afraid, you mix things up a bit.

fluxfluidcontent和(对您特别重要)fluidpages一起玩,以扩展为TYPO3创建fluid模板的默认功能.

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

  • flux 是解析和重构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

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

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>

大多数通量模板(无论流动的流体或流体含量如何)都分为(至少)3个f:section流体部分:

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

  • 配置采用您的表单字段
  • 预览会影响您的模板在后端的预览方式
  • 通常 Content Main (您可以在布局文件中影响命名,但应遵循我们在示例扩展中使用的约定)会渲染FCE/页面模板
  • 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

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

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.

这篇关于使用流体/助熔剂将配置字段添加到typo3页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆