I am working on Dreamweaver TBBs in SDL Tridion 2011 SP1.
I am unaware of handling component links in Dreamweaver TBBs.
Consider my Component name is \"A\"
There are two separate questions in this topic:
This is the answer to question 1. I will provide a separate answer for question 2.
In Tridion's default handling of expressions in DWT templates you only have access to fields of Components that are in the package. So if you want to access the fields of Component B, you will have to write a C# TBB that pushes that Component into the Package.
A sample C# fragment:
var componentA = (Component) engine.GetObject(package.GetValue("Component.ID"));
var fieldsA = new ItemFields(componentA.Content, componentA.Schema);
var linkField = (ComponentLinkField) fieldsA["Name"];
var componentB = linkField.Value;
var itemB = package.CreateTridionItem(ContentType.Component, componentB);
package.PushItem("ComponentB", itemB);
If you put this in a C# fragment TBB and drop it into your CT before the DWT, you can do this in your DWT:
@@ComponentB.Fields.first@@
Alternatively you can use Nuno's Dreamweaver Get eXtension (DGX) to access such fields without writing a TBB:
@@Get("Fields.Name.first")@@"/>
The only downside to using the DGX is that you will need to install it on every Tridion server. After that, a heap of extended functionality is available in your DWTs.