简体   繁体   English

在SDL Tridion 2011中的Dreamweaver模板构建块中处理多个组件演示文稿

[英]handling multiple component presentations in Dreamweaver Template Building block in SDL Tridion 2011

I am working on Dreamweaver TBB in SDL Tridion 2011 SP1. 我正在使用SDL Tridion 2011 SP1中的Dreamweaver TBB。 In the TBB I am using the data from different component presentations. 在TBB中,我使用来自不同组件演示的数据。

My Template Building Block looks like this.

Main Component: 主要成分:

<div>@@Component.Schema.Title@@</div>

<!-- TemplateBeginRepeat name="Fields.link" -->

    @@RenderComponentPresentation(Field, "tcm:1-8142-32")@@

<!-- TemplateEndRepeat -->

Component Template: tcm:1-8142-32 组件模板:tcm:1-8142-32

Its DWT TBB looks like this. 它的DWT TBB看起来像这样。

<!-- TemplateBeginIf cond="Component.Fields.text" --> 
    <div>@@RenderComponentField("text",0)@@</div>
<!-- TemplateEndIf -->

When I previewed the Component I got the output and all component presentations executed as expected. 当我预览组件时,我得到了输出,所有组件演示都按预期执行。

Output: 输出:

SchemaName
    data1
    data2

Then I created the Page with the page TBB. 然后我用页面TBB创建了页面。

<html>
    <head></head>
    <body>
        <!-- TemplateBeginRepeat name="Components" -->
            @@RenderComponentPresentation()@@
        <!-- TemplateEndRepeat -->
    </body>
</html>

The output is not as expected. 输出不符合预期。 The Component Template "tcm:1-8142-32" is not executed. 组件模板“tcm:1-8142-32”未执行。

output: 输出:

SchemaName

I want to make SiteEdit to linked component also. 我想将SiteEdit也用于链接组件。

Do I need to add extra templates to the existing ones? 我是否需要为现有模板添加额外的模板? I am using Tridion 2012 UI. 我正在使用Tridion 2012 UI。

I came to know that we need add isQueryBased , property must be set to true. 我开始知道我们需要添加isQueryBased ,属性必须设置为true。

If yes, can any one help the command to set it true? 如果是,是否可以帮助命令将其设置为true?

I don't know where the problem lies. 我不知道问题出在哪里。

Can any one help me out to modify the code and implement SiteEdit for the embedded Component? 任何人都可以帮我修改代码并为嵌入式组件实现SiteEdit吗?

In a Dreamweaver template RenderComponenetPresentation() can be called in two ways. 在Dreamweaver模板中,可以通过两种方式调用RenderComponenetPresentation()。

  1. If you are iterating through the Component Presentations on a page ( which I think is what you are doing?) 如果您正在遍历页面上的组件演示文稿(我认为您正在做什么?)

  2. If for some reason you need to Render a component with a different template, not the one you've added it to the page with. 如果由于某种原因,您需要使用不同的模板渲染组件,而不是将其添加到页面中的模板。

Assuming number one is what you are doing, then you have added the Component to the page with the correct Template. 假设您正在执行的是第一个,那么您已使用正确的模板将组件添加到页面中。 Therefore you can call @@RenderComponentPresentation()@@ with no arguments like this: 因此,你可以调用@@ RenderComponentPresentation()@@,不带这样的参数:

<html>
    <head></head>
    <body>
        <!-- TemplateBeginRepeat name="Components" -->
            @@RenderComponentPresentation()@@
        <!-- TemplateEndRepeat -->
    </body>
</html>

"IsQueryBased" is unrelated to your problem. “IsQueryBased”与您的问题无关。 This is connected to SiteEdit and Dynamic Component Presentations. 它连接到SiteEdit和动态组件演示文稿。

Update - 更新 -

It looks like you have 2 questions here: 看起来你有2个问题:

  1. How can I call RenderComponentPresentation for linked components 如何为链接组件调用RenderComponentPresentation
  2. How can i make the Component be "SiteEditable" 如何使组件成为“SiteEditable”

Looking at question 1 - Assuming you the array of components are not component presentations on the page your initial method was almost correct: 看问题1 - 假设您的组件数组不是页面上的组件演示文稿,那么您的初始方法几乎是正确的:

@@RenderComponentPresentation(Component.ID,"tcm:xx-xx-xx")@@

You should be able to get the component ID from the array, but you will need to specify the ComponentTemplate ID yourself. 您应该能够从数组中获取组件ID,但您需要自己指定ComponentTemplate ID。

For testing purposes, first of all hard code the Tcm ID of the Component Template. 出于测试目的,首先硬编码组件模板的Tcm ID。

Since putting Tcm ids in templates is bad practice, you will then need to write a TBB to make this available in the package for you. 由于将Tcm ID放在模板中是不好的做法,因此您需要编写TBB以便在包中为您提供。 You can then replace the Tcm Id you used for testing. 然后,您可以替换用于测试的Tcm Id。

In relation to your SiteEdit question, this guide might help, if not post a new question detailing the exact nature of your issue. 关于您的SiteEdit问题,如果不发布详细说明问题确切性质的新问​​题, 本指南可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM