navigation - Is it possible to get Children of children in a SilverStripe menu? -


i'm putting 3 tier navigation menu in silverstripe 3.1 template, , have following code in template:

<% loop $menu(1) %> ...   <% loop $children %> ...     <% loop $children %>      <li><a href="$link">$model</a></li>     <% end_loop %>   <% end_loop %> <% end_loop %> 

however i'm not getting output expect 3rd tier. possible children of children? if not, should instead? thanks!

yes possible loop through children of children loop.

your code looks correct me. should work correctly.

here few possible issues check.

make sure pages @ each level have showinmenus set true. $children , $menu(1) returns pages have showinmenus set true. checkbox can found in settings tab of page. otherwise can use $allchildren instead of $children hidden pages well.

make sure site tree has pages 3 levels deep. obvious thing check.

$model not in built page variable. must custom variable have set. make sure set page, has values filled in , accessible on front end.

here test template code can use check output of site tree. may in debugging problem:

<ul> <% loop $menu(1) %>     <li>         <a href="$link">$title - $model</a>         <% if $children %>         <ul>         <% loop $children %>             <li>                 <a href="$link">$title - $model</a>                 <% if $children %>                 <ul>                 <% loop $children %>                     <li>                         <a href="$link">$title - $model</a>                     </li>                 <% end_loop %>                 </ul>                 <% end_if %>             </li>         <% end_loop %>         </ul>         <% end_if %>     </li> <% end_loop %> </ul> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -