Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Show parent items instead in sidebar menuShow parent items instead in sidebar menu
Previous
 
Next
New Post
5/24/2016 9:59 AM
 

Hi DNN Experts,

I hope you can help me out with something I need to customize at my left sidebar DDRMenu. I've got it configured using the xslt template mechanism. My main menu is a DDNGo megamenu configured like:

ProductCategoryA                    
Sub product A-1             /           Sub product A-2        /       Sub product A-3
   product A-1-1                               Product A-2-1                       Product A-3-1
   product A-1-2                               Product A-2-2                       Product A-3-2
      product A-1-2-1
      product A-1-2-2

If I click main menu item "ProductCategoryA" my sidebar needs to list "Sub product A-1" , "Sub product A-2" and "Sub product A-3". Now if I click "Sub product A-1" it should list "Product A-1-1" and "Product A-1-2". As soon as I click product A-1-2 it should list "product A-1-2-1" and "product A-1-2-2", but if I click "Product A-1-1" having no child items, it should actually list "Product A-1-1" and "Product A-1-2" (so all items under the parent node unstead of nothing).

In short: As soon as my main menu opens a menu item without child items, the left sidebar should show it's parents child items instead of nothing (no children). If there are child items it should list them instead.

Now I've got the nodeselector as 0,0,0. I believe the template is only called for the current node? So I'm thinking to set the nodeselector to -3,0,0 to have it always pass all menu items to the template.

Now within the template I believe I could check with:

   <xsl:choose>
<xsl:when test="count(../*) > 0"> 
<span>We've got nodes on this page, so show them</span>
                </xsl:when>
               <xsl:otherwise>
<span>We don't have nodes, call 
<xsl:apply-templates select="parent::parent::node()"> to list grandparent nodes instead?
               </xsl:otherwise>
           </xsl:choose>

However, this would list all menu items and not only those as of the current page level. I think my question is: How could I check the current selected menu item node within the nodelist? Would this be @selected? In that case I could loop all nodes untill I reach the @selected node, count items for that node and load grandparent nodes instead if it is 0?

Am I on the right track here or is there a way better solution? 


 
New Post
5/24/2016 11:25 AM
 

I would use the nodeselector.

Examples here: http://demo.40fingers.net/dnn-ddr-dem...
You can download the example skin to see what setting to use.

 
New Post
5/24/2016 11:31 AM
 

Thank you for your quick reply Timo, but as far as I can tell you use the nodeselector at the DDRMenu to set the root, skip items and depth. I can't see how we could use this to have it show parent node items if there are no child items conditionally? I think we will have to put that condition somewhere within the template?

 
New Post
5/25/2016 7:32 AM
 
Arjan Pottjewijd wrote:

Thank you for your quick reply Timo, but as far as I can tell you use the nodeselector at the DDRMenu to set the root, skip items and depth. I can't see how we could use this to have it show parent node items if there are no child items conditionally? I think we will have to put that condition somewhere within the template?

  Check out the example "Direct Children of current Page", when you click the "A" link it will show the children of "A", I think that's what you are after right or do I miss something?

It uses: <dnn:MENU MenuStyle="Menus/02.01-DDR-XSLT-UL-Classes" runat="server" NodeSelector="0,0,0"></dnn:MENU>
 
New Post
5/29/2016 11:24 AM
 

Thank again Timo, but I still need to make it conditional somehow. I have a top menu and the left side menu. Within the left menu there is always only 1 level of menu items. It should show child items of the current selected menu item if there are any child items, OR, if there are no more child items, show items at the same level.

I know how to do both with the nodeselector (show only child items or show parent child items). But how do I conditionally set that? If the current menu page has child items use nodeselector(0,0,0) and if it has no child items use nodeselector(-1,0,0) ? That's where I'm still stuck :-).

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Show parent items instead in sidebar menuShow parent items instead in sidebar menu


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out