7

I'd like to know how to implement multiple text field in component link field.

My situation is

Component A has a single component link field "Note1". "Note1" field has a value of a Note Component. Note Component has a multiple text field "Text".

In the DW Template of the CT for Component A, I'd like to retrieve multiple text field "Text" Values. (If possible, as Inline Editable)

Could you give me any ideas?

10

Values from Linked Components are not available to DWT by default. You can easily push the linked Component into the package using a C# TBB before your DWT is invoked, create a DWT extension function to access those values or use the Dreamweaver Get Extension from SDL Tridion World.

As an alternative you should consider whether you should be rendering a Linked Component in the DWT of the linking Component. Let's say that you have a Press Release component that links to a Product component.

What you are describing is having something like this in your Press Release DWT:

<h2>@@Fields.Title@@</h2>
@@Fields.Body@@
<div>
    <h3>@@Fields.LinkedProduct.Title</h3>
    @@Fields.LinkedProduct.ShortDescription@@
</div>

Is it really the job of the Press Release's DWT to render anything but the title of the Product?

Or should you instead have a DWT for the Product-as-it-is-visible-in-a-press-release? The above fragment would then be something like this:

<h2>@@Fields.Title@@</h2>
@@Fields.Body@@
@@RenderComponentPresentation(Fields.LinkedProduct, ProductSummaryTemplate)@@

There is a good explanation of this in Walter van der Heiden's article on the different levels of compound templating.

| improve this answer | |
  • Hi! Frank. Thank you very much for your advice. Hopely I'd like to code inline-editable for experience manager. if possible, i'd like to implement just in one DWT using a useful TBB [Get Linked Components] from Sdl tridion world or DGX – Naoki Apr 17 '13 at 15:30
  • I think in this case that you use a useful TBB [Get Linked Components] , because the component link field is single value field, this TBB push a Component to the package not component array. do i need to use DGX also in order to inline-editable? – Naoki Apr 17 '13 at 15:33
4

There is multiple solutions to your question as there usually is, most obvious ones I would say:

  1. Render your Component Links as separate Component Presentations
  2. Write out the fields by adding the information to the package

For #2 you could use the Dreamweaver Get eXtension (DGX) or decide to add the field yourself using a custom Template Building Block. You will most likely not get around the fact that you need to write code for this, as it is not something which purely can be done in Dreamweaver syntax only.

I suspect you will need to create a so called Dummy Component Array. For example, you push in the package a Component Array with three dummy TCMURIs (they can all be tcm:0-0-0, it doesn't matter what value they have). Then you create three package variables named: Var_0, Var_1, Var_2. Now in your DWT Template you can use:

<!-- TemplateBeginRepeat name="MyDummyArray" -->
  @@Text_${TemplateRepeatIndex}@@
<!-- TemplateEndRepeat -->

Which will result you in the values of your three package variables. Now each variable would relate to a single value of your multi value field. So the number of variables here relate to the number of values, and the values will be the values of your multi value field.

| improve this answer | |
  • Hi! Bart.Thank you very much for your answer. Which do you think is the best practice of implementing with inline-editable for experience manager? and could you give me any breif example of the code? – Naoki Apr 17 '13 at 15:26
  • It really depends on what you need to do, and what makes most sense on your case. Both options are valid and good practice. See this answer for an example of how to make such fields inline editable tridion.stackexchange.com/questions/818/… – Bart Koopman Apr 17 '13 at 16:39
2

The easiest and scalable solution that I can think of is the use of DWT Extension. You can get the more details about DWT Extension at the below link:

SDL Tridion Community Extension

I hope it helps.

| improve this answer | |
  • Hi! Pankaj. Thank you very much for your advice. – Naoki Apr 17 '13 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.