Display sidebar only if children + only display level 1 children
|
96 posts
|
I want to display a sidebar only on pages which have children, and only display level 1 children. E.g.:
Each of those pages would have a sidebar containing:
And ‘Contact Us’ (which has no children) would have no sidebar. I’d like this taken care of automatically when new pages are created. Any suggestions, please? |
|
1493 posts
|
Hi David — Just for clarity’s sake, “Apples”, “Oranges” and “Plums” are all level 2 in Frog, since “Fruit” is level 1, and only [Root] is level 0. Is it only level 2 you’re after? (i.e., they will always be child pages to child-of-root pages) |
|
96 posts
|
Hi David, Ah, yes – that’s (of course! ;)) what I mean – only display level 2 children. So: |
|
1493 posts
|
It is possible that this will do the job for you. It’s a mashup of some find-level-1-pages code, and the sidemenu code that crusnac was just looking for:
It’s a bit of a mess :) but I guess the thing to do is put it in a snippet, then call the snippet in the layout (it needs to be in the layout to work). It gives you a Hope that helps. |
|
96 posts
|
Thanks, David, but something’s amiss. All I’m seeing is ‘<ul></ul>’ in the HTML and that appears on every page. |
|
1493 posts
|
Hmm… That means the conditions are failing for some reason. (Doh!) Is the site live? or localhost development? Are you up for a quick online chat about this? If so, shoot me a note at madebyfrog at gmail etc. |
|
96 posts
|
I was just about to suggest that. :) Email on the way. |
|
35 posts
|
funny, i was just working on a similar problem, but trying to figure it in another direction…. see my post here, oh and maybe you can fix what’s wrong with it? ;-) http://forum.madebyfrog.com/topic/1377?page=1#post_8922 |
|
1493 posts
|
Yes, and this was the failing code:
Oddly enough, this works fine in 0.9.4 (where I had tested the menu code on a localhost install). It turns out that in 0.9.5, the format for this must be:
with the ‘()’ parentheses following “level”, otherwise it fails to report a value. Very strange. Something must have changed! But something to be aware of when using |