[英]Typo3 V6: How to create a content element container? (without TV)
For a project I'm using Typo3 v6.0. 对于一个我正在使用Typo3 v6.0的项目。 I'm looking to create nested content elements, or a content element container.
我正在寻找创建嵌套的内容元素或内容元素容器。 I want to be able to create an inline two-column layout without using a specific template for it.
我希望能够在不使用特定模板的情况下创建内联双列布局。 I'm looking to do this without the use of templavoila.
我希望不使用templavoila这样做。
Extensions I have tried are gridelements
, kb_nescefe
, bs_fce
, multicolumn
but these do not work because they are not compatible with Typo3 V6. 我尝试过的扩展是
gridelements
, kb_nescefe
, bs_fce
, multicolumn
但是这些扩展gridelements
,因为它们与Typo3 V6不兼容。
I'm aiming for an end result like the attached image. 我的目标是像附加图像那样的最终结果。 Where the inline two-column content can be ommitted, used once or used multiple times, containing any other content element.
内联双列内容可以省略,使用一次或多次使用,包含任何其他内容元素。
I'm looking for the most simple solution here. 我在这里寻找最简单的解决方案。 I prefer not having to invest a lot of learning time in a solution like
flux
and whatnot ( http://fedext.net/ - looks cool, but also too timeconsuming for now) 我更喜欢不需要在像
flux
和whatnot这样的解决方案中投入大量的学习时间( http://fedext.net/ - 看起来很酷,但现在也耗费时间)
Any ideas? 有任何想法吗?
I'm the author of the Fluid extension suite (flux, fluidcontent, fluidpages etc.) and would of course like to help you learn about using FluidContent to make FCEs. 我是Fluid扩展套件的作者(流量,流体含量,流体页面等),当然希望帮助您了解使用FluidContent制作FCE。 It's really not as advanced as one might fear.
它确实没有人们担心的那么先进。 At the very least, it's much more compact than the example above.
至少,它比上面的例子更紧凑。 The following achieves the same result as your example, in FluidContent:
以下结果与FluidContent中的示例相同:
TypoScript (static loaded: css_styled_content, fluid_content) TypoScript(静态加载:css_styled_content,fluid_content)
plugin.tx_fed.fce.yourname {
templateRootPath = fileadmin/Templates # if you don't want to use an extension (1)
# partial and layout root paths not defined (2)
}
Regarding (1) you really, really should. 关于(1)你真的,真的应该。 Using an extension separates your user uploaded media etc. from your site content.
使用扩展程序可将用户上传的媒体等与您的网站内容分开。 If you do that instead, simply use an EXT:... path to the Private resources folder.
如果您这样做,只需使用EXT:...私有资源文件夹的路径。 And regarding (2) these paths are only necessary if you actually wish to use partials.
关于(2)这些路径只有在您真正希望使用部分时才是必需的。
Then, the template file itself (auto-detected when path where file is located is added in TS): 然后,模板文件本身(在TS中添加文件所在的路径时自动检测):
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="Content" />
<f:section name="Configuration">
<flux:flexform id="columns" label="Columns" icon="path/to/iconfile.jpg">
<flux:flexform.grid>
<flux:flexform.grid.row>
<flux:flexform.grid.column>
<flux:flexform.content name="left" label="Left content" />
</flux:flexform.grid.column>
<flux:flexform.grid.column>
<flux:flexform.content name="right" label="Right content" />
</flux:flexform.grid.column>
</flux:flexform.grid.row>
</flux:flexform.grid>
</flux:flexform>
</f:section>
<f:section name="Preview">
<flux:widget.grid />
</f:section>
<f:section name="Main">
<div class="row">
<div class="span6">
<flux:flexform.renderContent area="left" />
</div>
<div class="span6">
<flux:flexform.renderContent area="right" />
</div>
</div>
</f:section>
As you can see, you are entirely free to add any HTML you wish, use any ViewHelpers (even render TS objects if that's your thing). 正如您所看到的,您可以完全自由地添加任何您想要的HTML,使用任何ViewHelpers(如果那是你的东西,甚至渲染TS对象)。 To add additional content elements, simply add new template files - they will automatically be recognised.
要添加其他内容元素,只需添加新模板文件 - 它们将自动被识别。
But it will work differently from IRRE (which you can also achieve using Flux fields - let me know if you wish to see a demo of that): it will allos you to use the native drag-n-drop in TYPO3 to place your child content elements into actual content containers - like you used to do with TV. 但它的工作方式与IRRE不同(你也可以使用Flux字段实现 - 如果你希望看到它的演示,请告诉我):它会让你使用TYPO3中的原生拖放来放置你的孩子将内容元素转换为实际内容容器 - 就像您以前使用电视一样。
As such, Fluid Content is probably the closest you will come to TV. 因此,Fluid Content可能是您最接近电视的内容。
Regarding Flux being overkill, I'd like to give you an idea of what it actually performs: 关于Flux过度杀戮,我想告诉你它实际上的表现:
It may look overwhelming at first but I guarantee you there's less to know and to remember than in pibase, FlexForm XML, TS or native Extbase plugins. 一开始看起来可能看起来很难,但我保证你不会知道和记住比pibase,FlexForm XML,TS或本机Extbase插件更少。 If you want even more of a safety net I highly recommend using XSD schemas in your editor - this gets you auto-completion of the special
<flux:....>
tags and others. 如果你想要更多的安全网,我强烈建议你在编辑器中使用XSD模式 - 这可以让你自动完成特殊的
<flux:....>
标签和其他标签。
However: it will require you to learn a small bit about Fluid's logic: what Layouts and Partials are (you will most likely want to use those at some point) and how to use the special tags and refer to variables (which will be required in other use cases - but not the one at hand; it only requires simple ViewHelper tags). 但是:它需要你学习一点关于Fluid的逻辑:什么是Layouts和Partials(你很可能想在某些时候使用它们)以及如何使用特殊标签并引用变量(这将是其他用例 - 但不是手头的用例;它只需要简单的ViewHelper标记)。
I hope this helps. 我希望这有帮助。 And that I've reduced your fear that Flux is overkill and too much to learn ;)
而且我已经减少了你对Flux过度杀戮和太多学习的恐惧;)
Cheers, 干杯,
Claus aka. 克劳斯又名。 NamelessCoder
NamelessCoder
There is an startnext project where known bugs in grid_elements has been fixed. 有一个startnext项目 ,其中grid_elements中的已知错误已得到修复。 Afaik the next step is to make grid_elements compatible with TYPO3 6. But i guess, it will need a few weeks before they publish.
Afaik下一步是使grid_elements与TYPO3 6兼容。但是我想,它们需要几周才能发布。 But, perhaps they will start with Version 2 (which will compatible with TYPO3 6 these days...).
但是,也许它们将从版本2开始(这些日子将与TYPO3 6兼容......)。
Have a look at the forge project . 看看锻造项目 。
You might want to take a look at the extension DCE ( http://typo3.org/extensions/repository/view/dce ); 您可能需要查看扩展DCE( http://typo3.org/extensions/repository/view/dce ); there you can define the content element yourself.
在那里你可以自己定义内容元素。 Alternatively you can create literally anything with the http://fedext.net/ framework.
或者,您可以使用http://fedext.net/框架创建任何字面意思。 Just read the latest blog posts to get an idea on how to create dynamic content elements with those extensions.
只需阅读最新的博客文章,即可了解如何使用这些扩展创建动态内容元素。
Alright, I have semi solution. 好吧,我有半解决方案。 I have gone with the WEC Content Elements plugin to manage custom content elements.
我已经使用WEC内容元素插件来管理自定义内容元素。
Then I have used the following flexform: 然后我使用了以下flexform:
<T3DataStructure>
<ROOT>
<type>array</type>
<el>
<leftColumn>
<TCEforms type="array">
<label>Left column</label>
<config>
<type>inline</type>
<foreign_table>tt_content</foreign_table>
<maxitems>100</maxitems>
<appearance>
<showSynchronizationLink>0</showSynchronizationLink>
<showAllLocalizationLink>0</showAllLocalizationLink>
<showPossibleLocalizationRecords>0</showPossibleLocalizationRecords>
<showRemovedLocalizationRecords>0</showRemovedLocalizationRecords>
<expandSingle>1</expandSingle>
</appearance>
</config>
</TCEforms>
</leftColumn>
<rightColumn>
<TCEforms type="array">
<label>Right column</label>
<config>
<type>inline</type>
<foreign_table>tt_content</foreign_table>
<maxitems>100</maxitems>
<appearance>
<showSynchronizationLink>0</showSynchronizationLink>
<showAllLocalizationLink>0</showAllLocalizationLink>
<showPossibleLocalizationRecords>0</showPossibleLocalizationRecords>
<showRemovedLocalizationRecords>0</showRemovedLocalizationRecords>
<expandSingle>1</expandSingle>
</appearance>
</config>
</TCEforms>
</rightColumn>
</el>
</ROOT>
</T3DataStructure>
And the following frontend typoscript setup: 以下前端的typoscript设置:
tt_content.twoColumnContainer = COA
tt_content.twoColumnContainer {
10 = < lib.stdheader
20 = COA
20 {
wrap = <div class="twocolumn-container"> | </div>
10 = RECORDS
10 {
tables = tt_content
dontCheckPid = true
source.data = t3datastructure : pi_flexform->leftColumn
wrap = <div class="twocolumn-left"> | </div>
}
20 = RECORDS
20 {
tables = tt_content
dontCheckPid = true
source.data = t3datastructure : pi_flexform->rightColumn
wrap = <div class="twocolumn-right"> | </div>
}
}
This has resulted in a backend content element that uses the IRRE editor to add/edit content elements. 这导致了一个后端内容元素,它使用IRRE编辑器添加/编辑内容元素。 The container element has no preview though, and the two columns are positioned below one another (instead of next to eachother).
容器元素没有预览,并且两列位于彼此下方(而不是彼此相邻)。 All and all this is the only workable solution I have found after many hours of googling and trying out various methods/plugins.
所有这一切都是我在谷歌搜索和尝试各种方法/插件后找到的唯一可行的解决方案。
Hope this helps someone. 希望这有助于某人。
I would... 我会...
Extend the tt_content
table with 2 new fields (one for each column). 使用2个新字段(每列一个)扩展
tt_content
表。 You can do it manually in phpMyAdmin but then you would risk that the fields get accidentally deleted in the install tool when doing database comparison or something. 您可以在phpMyAdmin中手动执行此操作,但是在进行数据库比较时,您可能会在安装工具中意外删除这些字段。 So it's better to create a very simple extension for this - it's really just 2 files: ext_emconf.php describing the extension and ext_tables.sql for definition of the new fields.
因此最好为此创建一个非常简单的扩展 - 它实际上只有2个文件: ext_emconf.php描述扩展名, ext_tables.sql用于定义新字段。
Define in typo3conf/extTables.php a new content element type (= the container) and the 2 new fields (one for the left column and one for the right column) each of them being IRRE type. 在typo3conf / extTables.php中定义一个新的内容元素类型(=容器)和2个新字段(一个用于左列,一个用于右列),每个字段都是IRRE类型。
Set TCAdefaults.tt_content.pid = xxx
in TypoScript Configuration of the root page so that the left/right column elements are not stored on the page itself but in some sysfolder. 在根页面的TypoScript配置中设置
TCAdefaults.tt_content.pid = xxx
,以便左/右列元素不存储在页面本身上,而是存储在某个sysfolder中。
Define the new content element in the template setup so that it's rendered as you want it. 在模板设置中定义新的内容元素,以便根据需要进行渲染。
Example IRRE field: 示例IRRE字段:
'user_2col_left' => array(
'exclude' => 1,
'label' => 'Left column',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tt_content',
'maxitems' => '10',
'appearance' => array(
'collapseAll' => '1',
'expandSingle' => '1',
'newRecordLinkPosition' => 'bottom',
'showAllLocalizationLink' => '1',
'showPossibleLocalizationRecords' => '1',
'showSynchronizationLink' => '1',
'useSortable' => '1',
'enabledControls' => array(
'hide' => '0',
),
),
'behaviour' => array(
'disableMovingChildrenWithParent' => '1',
'localizeChildrenAtParentLocalization' => '1',
),
)
),
New content type example: 新内容类型示例:
t3lib_div::loadTCA('tt_content');
$TCA['tt_content']['columns']['CType']['config']['items'][] = array(
0 => '2 columns',
1 => 'user_2cols',
2 => '../fileadmin/user_2cols.gif',
);
t3lib_SpriteManager::addTcaTypeIcon('tt_content', 'user_2cols', '../fileadmin/user_2cols.gif');
$TCA['tt_content']['types']['user_2cols']['showitem'] = 'CType,header,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.visibility;visibility,--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.access;access,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.appearance,--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.frames;frames,--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.textlayout;textlayout,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.extended';
This is a simple (and a bit crude) solution for your particular case. 对于您的特定情况,这是一个简单(有点粗糙)的解决方案。 Better solution would take into account possibility of dynamically setting the number of columns in the container.
更好的解决方案将考虑动态设置容器中列数的可能性。
There will be some limitations as to working with the left/right column elements - you won't be able to easily move them or copy them between various containers. 使用左/右列元素会有一些限制 - 您将无法轻松移动它们或在各种容器之间复制它们。
Here is a video of a conference presentation on how to make FCEs without using TemplaVoila. 这是一个关于如何在不使用TemplaVoila的情况下制作FCE的会议演示视频。 Unfortunately only in German, but maybe it helps.
不幸的是只有德语,但也许有帮助。
I would suggest you to try the "multicolumn" plugin. 我建议你试试“multicolumn”插件。 It doesn't have dependencies as other implementations (I've tried almost if not all of the FCE substitutes) and it has nesting capabilities .. overall it's playing nicely with TYPO3.
它没有其他实现的依赖(我几乎尝试了所有的FCE替代品)并且它具有嵌套功能。总体来说它与TYPO3很好地协作。 Lately it has been ported to TYPO3 v6.
最近它被移植到TYPO3 v6。 I'm using it on more than few sites and I'm quite satisfied.
我在很多网站上使用它,我很满意。 (There are few bugs, like displaying wrong "Lost elements", but there is a fix on the forge page)
(有很少的错误,比如显示错误的“丢失元素”,但伪造页面上有修复)
Here is a link to TER documentation: http://typo3.org/extension-manuals/multicolumn/2.1.14/view/ 以下是TER文档的链接: http : //typo3.org/extension-manuals/multicolumn/2.1.14/view/
Try to use Fluid Powered TYPO3. 尝试使用Fluid Powered TYPO3。 With the new pre-cofigured Distribution "site"
使用新的预配置分发“网站”
http://typo3.org/extensions/repository/view/site
Screencast from Claus Due 来自Claus Due的截屏视频
http://vimeo.com/110469200
Don't forget to add typo3conf/AdditionalConfiguration.php How do I install it? 别忘了添加typo3conf / AdditionalConfiguration.php 如何安装?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.