7

I have a DD4T Component Template which contains 2 TBBs:

  1. Publish Binaries For Component
  2. Generate Dynamic Component

Both of these have the DD4T TBB parameters attached, and in this particular template, I only want top level binaries (ie those from the component I am publishing), but do want to dig about 3 levels deep into linked components for content. I set the LinkLevels parameter to 1 for the first TBB and 3 for the second. The problem is, in the rendered Output it only links one level deep for content.

I guess that somehow the second TBB is using the parameter values from the first (although I didnt debug it yet to find out), as if I increase the first TBB's LinkLevels parameter up to 3, the 2nd TBB generates 3 levels of linked content. If I remove the first TBB altogether it also works fine.

Has anyone experienced this, or have a good explanation for why its happening?

2 Answers 2

7

You should switch the TBB's around. The first DD4T template WILL generate the XML, no matter which one it is (otherwise it'll have a hard time finding the binaries). The generate dynamic component (or page for that matter) do nothing if there if they are not the first.

I suspect though that you might end up in a situation where you may get binaries for all three layers too.

1
  • Ah yes - I see now looking more closely at the package that the publish binaries TBB also generates the XML. Forgetting about my requirement to have different link levels for binaries and content, is it then necessary to have both TBBs, or can I just use Publish Binaries For Component?
    – Will Price
    Jun 10, 2013 at 7:56
4

The Template Engine in Tridion pushes the parameter values into the package before it invokes a TBB and removes them after the TBB has completed. So sequential TBBs should never see each other's parameter values.

The story is different when you are nesting TBBs, such as in the Default Finish Actions. Parameter values that you specify on an "outer" TBB , will be visible to the "inner" TBBs. An example of this is that the "Publish Binaries in Package" TBB can see the Structure Group URI that you specify on the Default Finish Actions (in which it is contained).

If the behavior you see is inconsistent with the above description, I suggest creating a custom TBB, opening it in a debugger and checking the parameter values in the package there. You really should only see the values for your current TBB. The values for earlier TBBs should not be in the package anymore at this stage.

1
  • Thanks Frank - its all working as you say, the confusion stemmed from the fact that the first TBB actually generates the output (as mentioned by Rogier) and the second TBB seems actually to do nothing (I was distracted by their names...)
    – Will Price
    Jun 10, 2013 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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