Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Babajide 26 posts 46 karma points
    Aug 09, 2012 @ 22:08
    Babajide
    0

    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.

  • Babajide 26 posts 46 karma points
    Aug 09, 2012 @ 22:14
    Babajide
    0

    The part that is highlighted in red, is an example the resources tab document type. It's hard coded at the moment

  • Richard Brookes 34 posts 57 karma points
    Aug 09, 2012 @ 23:47
    Richard Brookes
    0

    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

  • Babajide 26 posts 46 karma points
    Aug 10, 2012 @ 00:05
    Babajide
    0

    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>
             <href="#"><img src="@item.topImage" alt="@item.Name"></a>
              <h5>@item.title</h5>
              <h6>@item.bodyText</h6>
               <href="#">"@item.link" &gt;</a>
               <hr>
          </li>        
                               
     }

     Thanks

  • Richard Brookes 34 posts 57 karma points
    Aug 10, 2012 @ 00:31
    Richard Brookes
    0

    Hi Babjide,

    If this macro runs on your resources page template you should need no more than

    @foreach (var item in @Model.ResourcesTab)
     {
         
           <li>
             <href="#"><img src="@item.topImage" alt="@item.Name"></a>
              <h5>@item.title</h5>
              <h6>@item.bodyText</h6>
               <href="#">"@item.Link" &gt;</a>
               <hr>
          </li>        
                               
     }

    Does this work for you?

     

  • Babajide 26 posts 46 karma points
    Aug 12, 2012 @ 19:49
    Babajide
    0

    Thanks a lot Richard, it worked just fine.

Please Sign in or register to post replies

Write your reply to:

Draft