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

StackOverflow https://stackoverflow.com/questions/10749449

  •  10-06-2021
  •  | 
  •  

質問

I am working on Dreamweaver TBB in SDL Tridion 2011 SP1. In the TBB I am using the data from different component presentations.

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

Its DWT TBB looks like this.

<!-- 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.

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

output:

SchemaName

I want to make SiteEdit to linked component also.

Do I need to add extra templates to the existing ones? I am using Tridion 2012 UI.

I came to know that we need add isQueryBased, property must be set to true.

If yes, can any one help the command to set it 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?

役に立ちましたか?

解決

In a Dreamweaver template RenderComponenetPresentation() can be called in two ways.

  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:

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

"IsQueryBased" is unrelated to your problem. This is connected to SiteEdit and Dynamic Component Presentations.

Update -

It looks like you have 2 questions here:

  1. How can I call RenderComponentPresentation for linked components
  2. How can i make the Component be "SiteEditable"

Looking at question 1 - Assuming you the array of components are not component presentations on the page your initial method was almost correct:

@@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.

For testing purposes, first of all hard code the Tcm ID of the Component Template.

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. You can then replace the Tcm Id you used for testing.

In relation to your SiteEdit question, this guide might help, if not post a new question detailing the exact nature of your issue.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top