ZenphotoCMS Forum
Show sub-pages in menu always? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Show sub-pages in menu always? (/thread-5399.html)



Show sub-pages in menu always? - gwmbox - 2009-06-29

Hi, I am trying to figure it out but so far no setting or luck on thsi one (yet).

I have got a top level page and a series of sub-level pages. The pages are all published but they are only displayed in the menu when the top level page is activated. How can I change it so that the sub-poages are always shown?

Cheers




Show sub-pages in menu always? - sbillard - 2009-06-29

I am assuming you are using the printPageMenu() function. Unfortunately, it does not provide an option to do just what you wish. You would have to create a custom function to do that. You should be able to copy the existing printPageMenu() function from the zenpage-template-functions.php script. The calculaton that sets $process is what you want to change. If you just set $process to true, all pages will be shown. If you want something more selective than that, you will have to code the conditions.




Show sub-pages in menu always? - gwmbox - 2009-06-29

Ok, I am assuming you mean this part

foreach (&#36;pages as &#36;page) { &#36;pageobj = new ZenpagePage(&#36;page['titlelink']); &#36;level = max(1,count(explode('-', &#36;pageobj->getSortOrder()))); &#36;process = ((&#36;option == 'list' || &#36;option == 'list-top') && &#36;level==1 // show the top level || ((&#36;option == 'list' || (&#36;option == 'omit-top' && &#36;level>1)) && ((&#36;pageobj->getID() == &#36;pageid) // current page || (&#36;pageobj->getParentID()==&#36;pageid) // offspring of current page || (&#36;level 1 && strpos(&#36;pageobj->getSortOrder(), &#36;myparentsort) === 0)) // direct ancestor ) || (&#36;option == 'list-sub' && (&#36;pageobj->getParentID()==&#36;pageid) // offspring of the current page ) ); if (&#36;process) { if (&#36;level > &#36;indent) { echo "\n".str_pad("\t",&#36;indent,"\t")."\n"; &#36;indent++; &#36;parents[&#36;indent] = NULL; &#36;open[&#36;indent] = 0; } else if (&#36;level < &#36;indent) { &#36;parents[&#36;indent] = NULL; while (&#36;indent > &#36;level) { if (&#36;open[&#36;indent]) { &#36;open[&#36;indent]--; echo "\n"; } &#36;indent--; echo str_pad("\t",&#36;indent,"\t")."\n"; } } else { // level == indent, have not changed if (&#36;open[&#36;indent]) { // level = indent echo str_pad("\t",&#36;indent,"\t")."\n"; &#36;open[&#36;indent]--; } else { echo "\n"; } }
Not really sure part to edit, but I am thinking the &#36;level > &#36;indent part but not sure?




Show sub-pages in menu always? - acrylian - 2009-06-29

I really thought we added this option for both the printAlbumMenu() (which already has it) and printPageMenu(). Anyway this option should be there so I will see to add it soon.




Show sub-pages in menu always? - sbillard - 2009-06-29

As to the answer to your question. To show all pages, change the &#36;process line to &#36;process=true. To show all pages to nesting level x change the line to say &#36;process = &#36;level




Show sub-pages in menu always? - gwmbox - 2009-06-29

How easy was that - cheers for the quick solution




Show sub-pages in menu always? - acrylian - 2009-06-29

Tonight's nightly will also have the parameter &#36;showsubs for this.