Typo3 键入脚本自定义内容在模板中获取媒体图像
我想要一个只渲染图像的自定义元素。 我已经创建了一个自定义扩展名 这就是我得到的: ext_tables.phpTypo3 键入脚本自定义内容在模板中获取媒体图像,typo3,typoscript,typo3-7.6.x,Typo3,Typoscript,Typo3 7.6.x,我想要一个只渲染图像的自定义元素。 我已经创建了一个自定义扩展名 这就是我得到的: ext_tables.php \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(' mod.wizards.newContentElement.wizardItems.common.elements { cce_teaser { icon = EXT:core/Resources/Public/Icons
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
mod.wizards.newContentElement.wizardItems.common.elements {
cce_teaser {
icon = EXT:core/Resources/Public/Icons/T3Icons/content/content-image.svg
title = Produkt Bild
description = Hauptbild auf der Produktseite
tt_content_defValues.CType = product_image
}
}
mod.wizards.newContentElement.wizardItems.common.show := addToList(cce_teaser)
');
$TCA['tt_content']['columns']['CType']['config']['items'][] =
array(
'Custom Content Elements',
'--div--'
);
$TCA['tt_content']['columns']['CType']['config']['items'][] =
array(
'Hauptbild auf der Produktseite',
'product_image',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'ext_icon.gif'
);
$TCA['tt_content']['types']['product_image']['showitem'] = '
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.general;general,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.header;header,
--div--;Text,
bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css], rte_enabled;LLL:EXT:cms/locallang_ttc.xml:rte_enabled_formlabel,
--div--;Bilder,
image,
--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,
';
我得到的结果是:
2000\u产品\u第t3s页
tt_content.product_image = COA
tt_content.product_image {
10 = FLUIDTEMPLATE
10 {
file = {$resDir}/Private/Templates/ProductDetailImage.html
partialRootPath = {$resDir}/Private/Partials
layoutRootPath = {$resDir}/Private/Layouts
}
}
ProductDetailImage.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:ce="http://typo3.org/ns/TYPO3/CMS/FluidStyledContent/ViewHelpers" data-namespace-typo3-fluid="true">
<h1>Test</h1>
<f:debug>{data}</f:debug>
<!-- HOW CAN I GET THE IMAGE INFORMATIONS? SRC, TITLE, WITH, HEIGHT ... -->
</html>
试验
{data}
模板ProductDetailImage.html已呈现,但我不知道如何获取图像数据。
有人知道我要做什么吗?请帮忙
谢谢大家的帮助 如果您的图像上载字段使用FAL正确配置,则由于TYPO3 7.6,您可以使用FLUIDTEMPLATE中的处理器。要获取图像数据,可以使用ViewHelper或这些处理器。在这里查看文件处理器:嗨,保罗,谢谢你的回答!你能给我解释一下“如果你的图像上传字段使用FAL配置正确吗?”你能举一个简短的例子吗?你的ContentObject中是否有一个工作的“上传/选择文件”-字段?ist是否正确保存了所选文件?你的TCA配置为显示“图像”字段“我目前不确定这是字段是否仍然存在于TYPO3中,还是已被重命名。但是如果你有一个图像的字段,一切都可以。我的解决方案:
tt_content.product_show_image=COA tt_content.product_show_image{10=FLUIDTEMPLATE 10{file={$resDir}/Private/Templates/ProductContentImage.html partialRootPath={$resDir}/Private/Partials-layoutRootPath={$resDir}/Private/Layouts dataProcessing.10=TYPO3\CMS\Frontend\dataProcessing\fileprocessor dataProcessing.10{references{table=tt_content fieldName=image}as=images}}