2015-09-02 12 views
0

我想完全按照标题中提到的内容进行操作。我想在某个Col Position(在我的后端布局中定义)中解开(重新定义输出,即使需要)一个内容元素(textpic,因为我用它作为滑块输出)。 我用Jquery完成了它,但这看起来是一个子解决方案。我需要在TypoScript中打开TextPic CElement的某个colPos

我的代码:

tt_content = CASE 
tt_content { 
key.field = colPos 
#10 = CASE 
10 { 
    #key.field = CType 
    stdWrap.innerWrap.cObject > 
    stdWrap.innerWrap2 > 
    dataWrap > 
    prepend > 
    textpic.20.text.10.10.stdWrap.dataWrap > 
    image.20.imageStdWrap.dataWrap > 
    image.20.imageStdWrapNoWidth.wrap > 
    image.20.imageColumnStdWrap.dataWrap > 
    image.20.layout.default.value = ###IMAGES######TEXT### 
    image.20.layout.1.value < image.20.layout.default.value 
    image.20.layout.2.value < image.20.layout.default.value 
    image.20.layout.8.value < image.20.layout.default.value 
    image.20.layout.9.value < image.20.layout.default.value 
    image.20.layout.10.value < image.20.layout.default.value 
    image.20.layout.17.value < image.20.layout.default.value 
    image.20.layout.18.value < image.20.layout.default.value 
    image.20.layout.25.value < image.20.layout.default.value 
    image.20.layout.26.value < image.20.layout.default.value 
    image.20.rendering.dl.imageRowStdWrap.dataWrap > 
    image.20.rendering.dl.oneImageStdWrap.dataWrap > 
    image.20.rendering.dl.imgTagStdWrap.wrap > 
    image.20.rendering.dl.editIconsStdWrap.wrap > 
    image.20.rendering.dl.caption.wrap > 
    textpic.20.text.10.10.stdWrap.dataWrap > 
    textpic.20.text.wrap > 
} 
} 

任何人有一个想法甚至一个片段? ;)

Thx很多提前任何帮助。

回答

0

I have answered a question similar this once before

而是改变整个tt_content配置的则只是改变它在你需要它。

在下面的例子中,我创建了一个名为'noWraps'的新渲染方法,在这里我清除了所有的包装。

接下来,我创建一个内容lib lib.yourContent,您可以随意命名它。我们选择我们喜欢的colPos,从我们的例子中我们使用colPos = 10。然后,我们明确告诉renderObj复制tt_content配置,然后我们重写'textpic'renderMethod以使用'noWraps'。

# Create a new renderMethod named 'noWraps' which can be used across the whole system 
tt_content.textpic.20.rendering.noWraps { 
    imageRowStdWrap.dataWrap = | 
    noRowsStdWrap.wrap = | 
    oneImageStdWrap.dataWrap = | 
    imgTagStdWrap.wrap = | 
    editIconsStdWrap.wrap = | 
    caption.wrap = | 
} 

lib.yourContent < styles.content.get 
lib.yourContent { 
    select.where = colPos = 10 
    renderObj < tt_content 
    renderObj { 
    # Set renderMethod to 'noWraps' only for this section 
    textpic.20.renderMethod = noWraps 
    } 
} 

上面的代码仍然未经测试,但它应该工作 - 只要问它不。

我可以看到,你也覆盖了默认的布局,但你没有提到你的问题?如果你需要覆盖这个,只需添加/更新以下内容。

lib.yourContent < styles.content.get 
lib.yourContent { 
    select.where = colPos = 10 
    renderObj < tt_content 
    renderObj { 
    # Set renderMethod to 'noWraps' only for this section 
    textpic.20.renderMethod = noWraps 
    textpic.20.layout > 
    textpic.20.layout = TEXT 
    textpic.20.layout.value = ###IMAGES######TEXT### 
    } 
} 

由于您在您自己的示例中只是将所有不同的情况覆盖到相同的值,我们也可以将它重新定义为静态值。首先我们使用textpic.20.layout >来清除默认配置。然后,我们把它定义为一个文本对象textpic.20.layout = TEXT,然后在结束时,我们设定的值textpic.20.layout.value = ###IMAGES######TEXT###

更新:下面是测试,并与TYPO3 CMS 7.4.0

我增加了一些额外的代码删除最后一个工作包装。

# Create a new renderMethod named 'noWraps' which can be used across the whole system 
tt_content.textpic.20.rendering.noWraps { 
    imageRowStdWrap.dataWrap = | 
    noRowsStdWrap.wrap = | 
    oneImageStdWrap.dataWrap = | 
    imgTagStdWrap.wrap = | 
    editIconsStdWrap.wrap = | 
    caption.wrap = | 
    allStdWrap.dataWrap = | 
} 

lib.yourContent < styles.content.get 
lib.yourContent { 
    select.where = colPos = 10 
    renderObj < tt_content 
    renderObj { 
    # Set renderMethod to 'noWraps' only for this section 
    textpic.20.renderMethod = noWraps 
    textpic.20.imageStdWrap.dataWrap = | 
    textpic.20.imageStdWrapNoWidth = | 
    textpic.20.layout > 
    textpic.20.layout = TEXT 
    textpic.20.layout.value = ###IMAGES######TEXT### 
    } 
} 
+0

谢谢您对此发表评论。我认为它会工作,但不知何故,我无法将数据解析到我的标记中。 (使用css_styled_template),当我尝试解析em时,他不知道lib.slidercontent。 – Marc

+0

我不确定我是否理解你的正确 - 你没有得到任何输出? 我刚刚测试了上面的代码,并添加了一些小的修改,以删除一些额外的包装 - 但它的工作 – Lasse

+0

再次感谢这个史诗般的解决方案,我想我将在未来经常使用它。我明白了,在我的Typoscript中缺少一个支架。我希望Typo3 7对Typoscript后端编辑器有更好的调试;) – Marc

相关问题