Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Dec 09, 2012 @ 10:37
    Fuji Kusaka
    0

    Displaying SubContent

    Hi everyone,

    I have some issues when trying to display a list of SubContent and its headers. This is how my content section looks like

    Content
    --- configurations
    -- home
    -- Content 1
    -- Subcontent (1-6)
    -- Content 2
    -- Subcontent (1-6)
    -- Content 3
    -- Subcontent (1-6)

    So whenever am in any of the subContent page i need to display the heading that is Content 1, SubContents(1-6) and Content 2 and Content 3.

    Atm i cant get Content 2 and Content 3 to display when am in any of the subContent. Here is how my code looks like

    @{ 
    dynamic Resorts = Model.NodeById(1050);
    var rootNode = Model.AncestorOrSelf(3);
    var livel = 3;

    <div id="navigations-container">    
    @if(Model.Level > livel){
    <div class="list-active">
    <div class="hotel-list-logo @Library.Join("-", @Model.AncestorOrSelf(3).Name,"mnu-logo").Replace(" ", "-")"></div>
       <div class="hotel-list-name-active">test<span class="htl-active">@Model.AncestorOrSelf(3).Name</span></div>
    </div>
    <div class="hotel-page-nav">
    <ul>
    @if(rootNode.Children.Count() > 0){
    foreach(dynamic content in rootNode.Children.Where("Visible")){
    <li><a href="@content.Url" class="@Library.If((content.IsLast()),"spOff villas-color","")">@content.Name</a></li>
    }
    }
      </ul>
    </div>
    }  
    }

    Any help on this please

  • Troels Larsen 75 posts 280 karma points
    Dec 09, 2012 @ 11:20
    Troels Larsen
    0

    Hey Fuji

    if u have a properti defined on u doctype that has the hotels heading. u could use @Model._heading where heading is the name of the property. 

    the _ makes it recursive and is just what u are looking for i gues. 

  • Fuji Kusaka 2203 posts 4220 karma points
    Dec 09, 2012 @ 11:33
    Fuji Kusaka
    0

    Not really....to be  more precise when dispplaying the navigation from the homepage i will only display content 1, content 2 and content 3. When click on any of the content url it will redirect to the first child of the content. 

    So when this page is opened you will still get the header from content 1, its sub contents and eventually content 2 and content 3. Just as if you are opening or closing a collapsible content.

  • Fuji Kusaka 2203 posts 4220 karma points
    Dec 09, 2012 @ 12:05
    Fuji Kusaka
    0

    Got it working somehow, but still i need to i need to display the Active Content on Top always. That is if am on Content 1 , i will display like this

    Content 1 
    Sub
    Sub
    Content 2
    Content 3

    And if am on Contetn 2 it should be

    Content 2
    Sub
    Sub
    Content 1
    Content 3

    Here is how i proceeded to get the first part working now i need to figure out how to order by active content

     

    dynamic Resorts = Model.NodeById(1050); 
    var rootNode = Resorts.AncestorOrSelf(2).Descendants("testingContent");
    <div id="navigations-container">
    @foreach(var a in rootNode){
    if(a.IsAncestorOrSelf(Model)){
    <div class="hotel-list-active">
    <div class="hotel-list-logo @Library.Join("-", @Model.AncestorOrSelf(3).Name,"mnu-logo").Replace(" ", "-")"></div>
       <div class="hotel-list-name-active">test <span class="htl-active">@Model.AncestorOrSelf(3).Name</span></div>
    </div>
    if(a.Children.Count() > 0){
    <div class="hotel-page-nav">
    <ul>
    @foreach(dynamic content in a.Children.Where("Visible")){
    <li><a href="@content.Url" class="@Library.If((content.IsLast()),"spOff villas-color","")">@content.Name</a></li>
    }
    </ul>
    </div>
    }
    }
    else{
    <a href="@a.Children.First().Url">
                <span class="hotel-list">
                <div class="hotel-list-logo @Library.Join("-", @Model.AncestorOrSelf(3).Name,"mnu-logo").Replace(" ", "-")"></div>
                    <div class="hotel-list-name">test<span class="htl">@a.Name</span></div>
              </span>
                </a>
    }

     

Please Sign in or register to post replies

Write your reply to:

Draft