Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I am trying to create a nested menu and want a different page layout if the main page has nested children. The reason is that when there are nested children, I want this submenu to display in a column on the left side, and if not, then show the page as full width. And of course then also the nested children pages should also have this layout with the side column. There are different css classes needed for the grid layout, depending if there is the left column or not. But I'm not sure how to go about this. I was thinking an if/else statement, but I can't seem to find any condition that would render TRUE or FALSE as to whether a page has nested children or not. Any suggestions? I hope this makes sense. It's late and I'm tired and I've been pulling my hair out for hours trying to find a solution.
Hi, did you try to look for appropriate variable in the output of <cms:dump_all />? Hope you'll find something suitable, like k_total_children.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I did check that and unfortunately didn't find any variable like that available.
That variable should be available inside nested_pages, according to docs.

Please, confirm that you indeed defined template as nested_pages. Fetching pages from it with cms:nested_pages must make available certain variables, which you can use.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hey thanks, that was a huge help. Using that info, what I did was create a global variable set to false initially. Then inside the nested_pages tag, it looped through all nested pages and checked if it was the current page and then checked if it either had children or if it had a parent. If those cases were true, then I set my global variable to true, and then based on whether that variable was true or false, I embedded the corresponding html snippets with the desired layouts. It works! Many thanks.
5 posts Page 1 of 1
cron