I have three Schema X is content schema , Y is Embedded schema , Z is also Embedded schema. schema z is embedded within schema Y i.e also embedded schema Schema X have field called Heading
Schema Y have fields called Links and schema Z have fields called Link
using tom.net able to get the value of schema x and Y fields, Please help me out to get the value of the schema z embedded fields
sharing the code and source of the component and dwt:-
<Content xmlns="uuid:2e9e9220-fdd3-4ad0-a669-83f631bc880c">
<Heading>Already a customer?</Heading>
<Links>
<Title>File a Claim</Title>
<Link>
<enableItemaslink>Yes</enableItemaslink>
<Target xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="tcm:1026-62226-1024" xlink:title="New Window">New Window</Target>
<pageUrl>tcm:424-158685-64</pageUrl>
</Link>
</Links>
<Links>
<Title>Customer Service</Title>
<Link>
<enableItemaslink>Yes</enableItemaslink>
<pageUrl>tcm:424-158680-64</pageUrl>
</Link>
</Links>
</Content>
Code:-
var componentURI = "tcm:1042-63022";
Component component = (Component)engine.GetObject(componentURI);
ItemFields fields = new ItemFields(component.Content, component.Schema);
string title = fields["Heading"].ToString();
package.PushItem("Heading", package.CreateHtmlItem(title));
EmbeddedSchemaField links = fields["Links"] as EmbeddedSchemaField;
if (links !=null)
{
IList<ItemFields> linkFieldValues = links.Values;
foreach (ItemFields innerFields in linkFieldValues)
{
if (innerFields.Contains("Title"))
{
string linktitle = package.GetValue("Component.Fields.Links.Title");
package.PushItem("Title", package.CreateStringItem(ContentType.Text, linktitle));
}
}
}
In Dwt to render heading and title using @@Heading@@ @@Title@@