Reputation: 71
How does the info used in master template as umbraco
items get passed down to child templates?
Master template
Child template 1
Child template 2
In Master template
I have
<umbraco:Item field="training" runat="server" />
The field training
is text that is entered in umbraco
's content tab. This info needs to be entered once and displayed in page placeholders that use Child template 1 and 2
.
Upvotes: 2
Views: 1631
Reputation: 9051
If the doctype of the master template contains this training field, the value can be picked up in the nodes that use child templates - using the recursive options.
I've done this with macros, where to get the training item in a child (but set in the master) you use the '$' prefix (http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax):
<umbraco:macro alias="macroAlias" parm1="[$training]" runat="server"/>
Recursive items are less often done (I don't know if I've ever used this technique - it is more common to use a macro containing razor/ascx or xslt for repeated content). In this case you want to pick up a recursive item value (http://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/settings-in-root-node-and-value-from-recursive-search) so you'd use:
<umbraco:Item field="training" recursive="true" runat="server"></umbraco:Item>
In both cases umbraco will check the current node for the value, before looking at parents.
Upvotes: 2