Is it possible in a documenttype template (instance?) to include another documenttype.
I know I can add a partial view but then there is no associated node for data.
Right now I have a document type which loops it's children and then I do various logic including reading data from these children in order to display stuff. It seems wrong to place this logic in the top DocumentType. The logic should reside in the child. This would allow for better reuse of code.
I'm thinking it is not possible because that would mean pointing to an instans of a document type in the definition of another...That also seems wrong. But it would be nice to be able to inject a documenttype instance into another one somehow. Like Sitecore with placeholders.
Yes, what I want is what sitecore does where you can inject via placeholders!
Documenttypes and templates are 2 seperate things.
In essence a:
documenttype is for defining a definition
a content node uses a documenttype and here you can fill the fields
defined in a documenttype
a template (view) is used to display the content.
If you have a list of children in a template and you want to reuse the loop to show them you can do that with a partial view and include the partial view in every page where needed.
If this doesn't answer the question please give a example of the site structure and the result you try to achieve.
I guess that solves the problem although I would like code and data to be more tightly coupled. Just though that there might be a more elegant way.
Probably not.
That's why it would be nice to be able to inject a node (documenttype with template and node properties) into another node. Difficult to explain.
You could look into Nested content. This uses a documenttype that is "nested" in another. But that's not for children. Thats for repeatable data in a documenttype:
That's just a list of document types where you access the data from your "main" doctype template, right?
You are not using an associated template of the doctypes so that the node renders itself. I am basically doing something similar when I have the nodes af children.
Possible to add DocumentType inside another?
Is it possible in a documenttype template (instance?) to include another documenttype.
I know I can add a partial view but then there is no associated node for data.
Right now I have a document type which loops it's children and then I do various logic including reading data from these children in order to display stuff. It seems wrong to place this logic in the top DocumentType. The logic should reside in the child. This would allow for better reuse of code.
I'm thinking it is not possible because that would mean pointing to an instans of a document type in the definition of another...That also seems wrong. But it would be nice to be able to inject a documenttype instance into another one somehow. Like Sitecore with placeholders.
Yes, what I want is what sitecore does where you can inject via placeholders!
Documenttypes and templates are 2 seperate things. In essence a:
If you have a list of children in a template and you want to reuse the loop to show them you can do that with a partial view and include the partial view in every page where needed.
If this doesn't answer the question please give a example of the site structure and the result you try to achieve.
Frans
I guess that solves the problem although I would like code and data to be more tightly coupled. Just though that there might be a more elegant way. Probably not.
That's why it would be nice to be able to inject a node (documenttype with template and node properties) into another node. Difficult to explain.
Thank you for your answer.
You could look into Nested content. This uses a documenttype that is "nested" in another. But that's not for children. Thats for repeatable data in a documenttype:
Nested content documentation
The power of Umbraco in my eyes is that I can access all the content everywhere I want.
That's just a list of document types where you access the data from your "main" doctype template, right? You are not using an associated template of the doctypes so that the node renders itself. I am basically doing something similar when I have the nodes af children.
Yep
Ok, could still be useful and I did not know about it. Thanks for the tip!
is working on a reply...