Copied to clipboard

Flag this post as spam?

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


  • Darren Wilson 238 posts 646 karma points
    Oct 28, 2011 @ 15:24
    Darren Wilson
    0

    Starterkit Multi Level Nav

    Hi,

    Another newbie question: I'm using the basic Starter Kit - I want to create a dropdown menu - I have all the css, etc in place, however, I'm unfamiliar with xslt. I want to merge the umb2ndLevelNavigation.xslt and umbTopNavigation.xslt so I get:

    Top Level

     • Second Level

     • Second Level

    Etc.

    I hope that makes sense - any help will be appreciated.

    Darren

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2011 @ 19:00
    Rich Green
    0

    Hi Darren,

    It might be worth posting the snippet of html you're trying to replicate.

    Rich

  • Darren Wilson 238 posts 646 karma points
    Oct 29, 2011 @ 00:13
    Darren Wilson
    0

    Hi Rich,

    What I want to achieve is for the 2nd level nav to appear when the top level is rolled over. I imagine you need to copy something out of the 2nd level xlst file and add this to the top level.

    Cheers

    Darren

  • Darren Wilson 238 posts 646 karma points
    Oct 29, 2011 @ 01:37
    Darren Wilson
    0

    I've trawled through the forum tonight looking for some pointers - some posts seem to recommend sitemap.xlst - is this an option?

    The effect I'm trying to achieve is here : http://www.shaw-online.com/client/big1/

    I'm learning as I'm going here - so please bear with me.

    Thanks for all your help.

    Darren

  • Rich Green 2246 posts 4008 karma points
    Oct 29, 2011 @ 10:44
    Rich Green
    0

    Hi Darren,

    I would try the sitemap.xslt as you say, basically from looking at the html the nav needs the first level and then the second level.

    Plug the sitemap.xslt in and then change the variable to restrict it to 2 levels.

    Let us know how you get on.

    Rich 

  • Darren Wilson 238 posts 646 karma points
    Oct 29, 2011 @ 11:43
    Darren Wilson
    0

    Hi Rich,

    Thanks for this, I'll give it a try later - do I need to change the variable in the sitemap.xlst or umbTopNavigation.xslt?

    Darren

  • Rich Green 2246 posts 4008 karma points
    Oct 29, 2011 @ 14:47
    Rich Green
    0

    Hey Darren,

    You only need one XSLT file for your nav, you can base this on sitemap.xslt

    Rich

  • Darren Wilson 238 posts 646 karma points
    Oct 30, 2011 @ 01:11
    Darren Wilson
    0

    Thanks Rich. I think I'm making this more complicated than I need to - if I insert the top and second level macros into the template it renders both, however the second level only appears when the top level is selected - is there an easy way of getting the second level to display when the top is rolled over?

    Darren

     <div class="menu" style="float:left">
        <div class="nav">
        <div class="table">
        <ul class="select"><umbraco:Macro Alias="umbTopNavigation" runat="server" /></ul>
        </div>
      </div>
      </div>
        <div class="menu_sub" style="float:left">
        <div class="nav">
        <div class="table">
        <ul class="select"><umbraco:Macro Alias="umb2ndLevelNavigation" runat="server" /></ul>
        </div>

  • Rich Green 2246 posts 4008 karma points
    Oct 30, 2011 @ 08:47
    Rich Green
    0
  • Darren Wilson 238 posts 646 karma points
    Oct 31, 2011 @ 00:11
    Darren Wilson
    0

    Hi Rich,

    This looks interesting - not sure where to begin though. I've installed the Cultive Razor Examples - where do I attach the code as indicated on the other post?

    @helper traverse(dynamic node){
     
    var maxLevelForSitemap =4;

     
    var values =newDictionary<string,object>();
      values
    .Add("maxLevelForSitemap", maxLevelForSitemap);

       
    var items = node.Children.Where("Visible && Level <= maxLevelForSitemap", values);
       
    <ul>
               
    @foreach(var item in items){
               
    var linkItemIsParent ="noFly";
               
    if(item.Level()>2&& item.Children.Count()>=1){
                linkItemIsParent
    ="fly";
               
    }
               
    var listItemIsParent ="hasNoSub";
               
    if(item.Level()==2&& item.Children.Count()>=1){
                listItemIsParent
    ="hasSub";
               
    }
                   
    <li class="@listItemIsParent"><a href="@item.Url"class="@linkItemIsParent">@item.Name</a>
        @traverse(item)
                    </
    li>
               
    }
       
    </ul>
    }
    <div class="menu">
        @traverse(@Model.AncestorOrSelf())
    </
    div>
    Thanks.
    Darren
  • Darren Wilson 238 posts 646 karma points
    Nov 03, 2011 @ 21:43
    Darren Wilson
    0

    Hi Rich,

    I've managed to solve this problem!! I used sitemap.xlst and a css menu from Stu Nicolls - worked first time!

    Darren

  • 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.

Please Sign in or register to post replies