Nav - all pages under current PLUS parent?

Posted by Community Admin on 03-Aug-2018 17:37

Nav - all pages under current PLUS parent?

All Replies

Posted by Community Admin on 03-Oct-2013 00:00

I have a vertical Left-hand Nav(LHN) that is set to "All pages under particular page". I need it to show the primary parent page in that list as well.
ie: Currently shows:
Subpage1
   SubsubpageA
Subpage2
Subpage3

Need it to show:
ParentPage
   Subpage1
     SubsubpageA
   Subpage2
   Subpage3

Can this be done very easily?

Posted by Community Admin on 08-Oct-2013 00:00

Hi Nikolei,

 You can achieve this by selecting Top-level pages (and their child-pages if template allows) option of the Sitefinity navigation in its designer.

Regards,
Ivan D. Dimitrov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 08-Oct-2013 00:00

That would show all top-level items though. I only want to show the single top level parent that groups whatever page you're on.

Posted by Community Admin on 08-Oct-2013 00:00

Dear Nik
 
I am not sure if I got your idea right.

I wanted once to just display the top level page as kind of breadcrumb stlye. I  used this .ascx. Maybe this is a starting point

.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SubNaviTitle.ascx.cs" Inherits="SitefinityWebApp.UserControls.SubNaviTitle" %>
 
<asp:Label ID="Label1" runat="server" Text="Home" CssClass="SubNaviTitle"></asp:Label>


.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using Telerik.Sitefinity.Web;
using Telerik.Sitefinity.Modules.Pages;
 
 
 
namespace SitefinityWebApp.UserControls
    public partial class SubNaviTitle : System.Web.UI.UserControl
    
        protected void Page_Load(object sender, EventArgs e)
        
            var actualNode = SiteMapBase.GetActualCurrentNode();
            if(actualNode != null)
            while (actualNode.ParentNode != null && actualNode.ParentNode.Title != "Pages")
            
                actualNode = actualNode.ParentNode as PageSiteNode;
 
            
            Label1.Text = actualNode.Title;
            
            else
            
                Label1.Text = " ";
            
 
        
    


Usually my scenario is as follows

Top Navigation with main menu items

Left side subnavi with all navigation items under the current selected top navigation item

The left side a the moment is still done by me with the panelbar (rad control enabled in admin) and datasource solution as described here: http://www.sitefinity.com/developer-network/forums/general-discussions-/menu-question

I never understood what the all under a current page option is good unless you make a ton of templates for each main navigation menu.

Markus

PS: as seen here: grandag.ch.mserver3.arvixevps.com/.../subaru-impreza-sti

Posted by Community Admin on 11-Oct-2013 00:00

Hello guys,

 Praise to Markus for the informative resource. I think I achieved the result using the Built in Navigation without Modifying it. I created the page node Hierarchy as described ( view images attached.) then in the navigation I selected "Custom selection of pages", selected the one I want and gave it a template - Horizontal with drop down menus. It produced the result in the second image.

Regards,
Ivan D. Dimitrov
Telerik

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 11-Oct-2013 00:00

Dear Ivan 

Can you make an example with two navigations

Main Naviation would have Test, 111, 211 shown (horizontal only top level
Secondary navigation - when you click on 211 it would show 222, 121, 122 

As per your screenshots 

And when you click on 212 it still shows 211, 222 (open wiht 222) 121, 122

This is my most often uses scenario splitting the navigation in main and secondary as seen in these examples.  

Preferable out of the box.

www.golf-winterberg.ch/golfpark
www.baumgartner-gartenbau.ch/bioteiche

grandag.ch.mserver3.arvixevps.com/.../
sternen-rafz.ch.mserver4.arvixevps.com/restaurant

Markus





Posted by Community Admin on 16-Oct-2013 00:00

Hi Markus,

 Following your directions I was able to achieve the requested result with only one Nav widget. Please see the screenshots attached. I find this a good way to get to the goal with the out of the box widget.

Regards,
Ivan D. Dimitrov
Telerik

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 16-Oct-2013 00:00

Thanks Ivan

I realy don't get it. Handpicking the pages means (unless I am wrong)

a) you need to have a template for each main menu item
b) if you add a page you need to go back and add that page to custom selection

If a) or b) is true I rather stick to my radControl Sitemap StartingNode offset method.

Markus

Posted by Community Admin on 17-Oct-2013 00:00

Hi Markus,

 You are correct - B is true. As you can add the navigation I have demonstrated to a template, you do need to add every newly created page to it if you want it to show. So far this is the most functionality our out of the box Navigation presents. 

Regards,
Ivan D. Dimitrov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 18-Oct-2013 00:00

Incase it's of any help to anyone, I came up with my own solution. By adding the following JS, it injects the title of the primary parent page ontop of the 2ndary navigation.

// Inject primary parent name in LHN
    if (jQuery(".sfSel").html() != undefined)
        activeNavParent = jQuery(".sfSel").html().replace('<span class="k-icon k-i-arrow-s"></span>', '');
        activeNavParentUrl = jQuery(".sfSel").attr("href");
 
        lhnMenu = jQuery(".leftnav ul.sfNavTreeview");
        if (lhnMenu != undefined)
            lhnMenuContent = lhnMenu.html();
            lhnMenuContent = '<li class="k-item k-first lhnparent"><a href="' + activeNavParentUrl + '" class="lhnparentlink">' + activeNavParent + '</a><ul>' + lhnMenuContent + '</ul></li>';
            lhnMenu.html(lhnMenuContent);
            //lhnMenu.prepend('<li class="k-item k-first"><a href="' + activeNavParentUrl + '">' + activeNavParent + '</a></li><ul>');
            //lhnMenu.append('</ul>');
        
    

Using the page structure you guys created, if the user was on 222, or 212, this script would add 211 above the normal listing of 222, 212, 121 and 122. I still have to drag the LHN navigation widget to each page and select show all pages under page X, but it displays what I need. It would be nice to have some more built-in options for secondary navigation.

Posted by Community Admin on 18-Oct-2013 00:00

Dear Nik

Thanks' for sharing.

Yes I would love to have the option to choose - All pages under current top page (whithout top page) as an default option.

Or at least let us be able to set an datasource.

Markus

Posted by Community Admin on 11-Nov-2014 00:00

I am having the same problem with Sitefinity trying to build a menu that is common in most CMS.

Using JS is not an option. Creating a custom widget for a standard behavior seems too much effort. Inserting the menu widget to a page every time I create a new page isn't an option either. It takes just way to much time and prone to failure.

 Is there no way to use the Sitefinity standard features to have a left menu showing "childs from the current top level page"?

Posted by Community Admin on 11-Nov-2014 00:00

Forgive me if you have already tried this or if this option was already described above.  I didn't read everything but have you tried the ShowParentPage on theadvanced options tabe of the navigation widget? (Attached Image)  Then you can create/change the widget template to included Parent Item template as shown on Documentation Link?

<ParentItemTemplate>
    <li>
        <a id="A1" runat="server" href="javascript:void(0);"><%# Eval("Title") %></a>                                                
    </li>                   
</ParentItemTemplate>

Posted by Community Admin on 12-Nov-2014 00:00

I guess your sample is referring to include the parent item.

But the issue is to show "All Childs of the Current Top-Parent".
Without the need to insert the menu on every page we create and without using a custom widget.

The attached fake screen capture shows how the left menu should look like.
It shows all child menu pages (including their sub-pages) from the CURRENT TOP PARENT menu item.

Is this doable with Sitefinity without a custom widget, Javascript, or adding the menu to any new page?

Posted by Community Admin on 17-Nov-2014 00:00

Hi all,

@Sebastian

The scenario you require is available out of the box. Simply add a Navigation widget to the template your pages are using. On the navigation widget select the "All pages under currently opened page"  option. This will achieve the needed result. Here is a video demonstration for further reference.

Regards,
Ivan D. Dimitrov
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 11-Dec-2014 00:00

I am trying to figure out how to do this right now. I have a template for interior pages with a navigation widget on the side. Since there are quite a few top level pages I would really like to avoid having to create a separate template for each top level page. My situation is almost identical to the "menu-fake" image you posted. So selecting all pages under a particular page is not an option, because that would require a new template for every top level page in the nav. And selecting all top level pages, while dynamic, still shows all siblings of the current top level page. Have you, or anyone else here, found a way to do this without writing a custom widget?

Posted by Community Admin on 16-Dec-2014 00:00

Hi all,

@Ethan

This scenario will require a custom navigation control as it basically combines the functionality of our "Top-level pages" and our "All pages under currently opened page"  navigation options. I can recommend you go through this blog post describing how to create a mega menu in Sitefinity. Additionally you can use our Pages API in order to bind the set of nodes you require along with any conditions on when they should display to a control of your chosing (I can recommend you use a RadPanelBar).

Regards,
Ivan D. Dimitrov
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 05-Mar-2015 00:00

In the 3.7 versions we had the StartingNodeOffset property, which reduced custom dev and mutliple templates. Any plans to roll this out in future versions? 

Related post:
http://www.sitefinity.com/developer-network/forums/general-discussions-/startingnodeoffset-in-sitefinity-navigation

This thread is closed