Hello,
I have a question about reusing nested content templates.
What I want to do is to be able to create multiple pages where each one has a carousel of images ("MyGarden", "MyHouse").
I have made a Document Type Collection (CarouselHolder) which in turn has underlying document types (CarouselImage).
Then I create a content page called "MyGarden"
When I then edit the template, I specify which page it should fetch its children (CorouselImages) from. Then I have to
enter a specific page (MyGarden) in the query builder. This means that if I create a new carousel page ("MyHouse") then I also have to create a new template first?
Is it possible to reuse a template in this case so that each Carousel content page uses the same template, but know
what images should it should use?
If I've understood you correctly then your structure has the children for the current node, so you ought to be able to do something like:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<CarouselHolder>
@{
var children = Model.Children();
}
@foreach(var carouselImage in children)
{
//output carousel image here - add code based on properties of the image
}
Then you don't need a separate view for the child pages.
PS, I would usually use something like a multi url picker here instead of having child nodes if you';re just outputting pictures, or if you need more properties like caption/overlay etc. then Nested Content with document type elements can work well.
Hello, and thanks for your answer! I went for the solution of using document type instead which gave me more flexibility (you can use it in any documenttype).
I must say, Umbraco is one amazing tool, and this community sure makes up for the reputation of being very friendly!
=)
Reuse template for Document Type Collection
Hello, I have a question about reusing nested content templates. What I want to do is to be able to create multiple pages where each one has a carousel of images ("MyGarden", "MyHouse").
I have made a Document Type Collection (CarouselHolder) which in turn has underlying document types (CarouselImage). Then I create a content page called "MyGarden"
When I then edit the template, I specify which page it should fetch its children (CorouselImages) from. Then I have to enter a specific page (MyGarden) in the query builder. This means that if I create a new carousel page ("MyHouse") then I also have to create a new template first?
Is it possible to reuse a template in this case so that each Carousel content page uses the same template, but know what images should it should use?
If I've understood you correctly then your structure has the children for the current node, so you ought to be able to do something like:
Then you don't need a separate view for the child pages.
PS, I would usually use something like a multi url picker here instead of having child nodes if you';re just outputting pictures, or if you need more properties like caption/overlay etc. then Nested Content with document type elements can work well.
Hello, and thanks for your answer! I went for the solution of using document type instead which gave me more flexibility (you can use it in any documenttype). I must say, Umbraco is one amazing tool, and this community sure makes up for the reputation of being very friendly! =)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.