Kentico 9 Hierarchical Menu Root Path Value

Jason Vaughan asked on June 9, 2016 20:21

I am new to Kentico, so please bear with me! What I am trying to do is create a hierarchical menu that has at least 3 levels. So far I have been able to display everything underneath the page I set my content path to, but how am I able to include that value at the root of the menu? In the example below you can see that I am on the "Academics" page. What I want to do is have a menu list on the left of the page displaying what you see below, but I always want to be able to include "Academics" as the root of the list. My content path is current set to "/{0}/{1}/{2}/%" If I set the path up one level I see "Academics", but I also see all of the other pages that are at that same level and that's not what I want.

Home / Programs & Courses / Academics (WANT SET TO ROOT OF BELOW LIST)

  • Academic Departments
    • Accounting
    • Business
    • Chemical Dependency Counseling
  • Credit Programs

Another question I had "once the previous issue is fixed." Is it possible to when I'm under the "Academics" page to only see the list expanded like this:

  • Academics
    • Academic Departments
    • Credit Programs

...but after I click on "Academic Departments" to have the list expanded like this:

  • Academics
    • Academic Departments
      • Accounting
      • Business
      • Chemical Dependency Counseling
    • Credit Programs

I apologize for all the questions, but I have only just started using the product at work and certain things wasn't sure what to search for. I appreciate everything!!!

Recent Answers


Laura Frese answered on June 10, 2016 01:54

You could set the Hierarchical Menu to just show the sub items, then in the Hierarchical Viewer web part HTML envelope:

Before:

<ul>
    <li>{% DocumentName %}

After:

</li></ul>

0 votesVote for this answer Mark as a Correct answer

Dawid Jachnik answered on June 10, 2016 08:45 (last edited on June 10, 2016 08:45)

Hello,

I think you need to change your transformations cancel the first and last one. Make just a item one on the level Academic Departments with similiar transfomration

<li>
    <span>{%DocumentName%}</span>
    <ul {% if( IsDocumentOnSelectedPath() ) { "style=\"display:block;\"" } %}>
        {^SubLevelPlaceHolder^}
    </ul>
</li>

inner ul should be display:none by default;

0 votesVote for this answer Mark as a Correct answer

Jason Vaughan answered on June 10, 2016 14:16

I have my menu working and showing all the sub-items, but {%DocumentName%} will give me the name of the current document that I am on, but I ALWAYS want in my case "Academics" to be the first item in the menu regardless of what page I am on. Is there a way to force that by any type of method to get a name by a specific node or something like that? Then depending on whether I am on the second or third level I want to be able to show or hide specific sections of the list.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.