I have a "resources" and "resources tab" document types So basically i want every "resources tab" page created under a resources page to shown on that resources page, as described in the image. The template is a "resources" template and i tried a couple of macros but they didn't work.
There are xslt and razor macro templates that will do this for you. The razor one is called list children by type and the xslt one is called list sub pages by document type. They both just pick up the children of the document you are on (in your case it will be resources) and filter to just those with a specific document type (resourses tab in your case) Both of these use the document type alias so if you have been unable to get these to work perhaps you should check that you are using the alias rather than the name and that you make sure the casing is correct.
How to nest document types
I have a "resources" and "resources tab" document types So basically i want every "resources tab" page created under a resources page to shown on that resources page, as described in the image. The template is a "resources" template and i tried a couple of macros but they didn't work.
The part that is highlighted in red, is an example the resources tab document type. It's hard coded at the moment
Hi,
There are xslt and razor macro templates that will do this for you. The razor one is called list children by type and the xslt one is called list sub pages by document type. They both just pick up the children of the document you are on (in your case it will be resources) and filter to just those with a specific document type (resourses tab in your case) Both of these use the document type alias so if you have been unable to get these to work perhaps you should check that you are using the alias rather than the name and that you make sure the casing is correct.
cheers
Thanks for the reply Richard. I tried a macro template but it didn't work and i cant figure out what is wrong. Here is the code for theg macro:
@foreach (var item in @Model.Resources[0].ResourcesTab)
{
<li>
<a href="#"><img src="@item.topImage" alt="@item.Name"></a>
<h5>@item.title</h5>
<h6>@item.bodyText</h6>
<a href="#">"@item.link" ></a>
<hr>
</li>
}
Thanks
Hi Babjide,
If this macro runs on your resources page template you should need no more than
@foreach (var item in @Model.ResourcesTab)
{
<li>
<a href="#"><img src="@item.topImage" alt="@item.Name"></a>
<h5>@item.title</h5>
<h6>@item.bodyText</h6>
<a href="#">"@item.Link" ></a>
<hr>
</li>
}
Does this work for you?
Thanks a lot Richard, it worked just fine.
is working on a reply...