Is there a way to use printPageMenu() somehow like this?:
printPageMenu('parent=The-name-of-the-parent');
Ik would like to have a pagemenu in my left column showing only the (sub)pages belonging to a certain gallery. Let's say I have a gallery about cars, then I would name my first page 'Cars', leave it empty, but asign a few subpages to this parent page. These subpages should show up in the leftside columns. The same for other galleries.
Comments
It is possible to show the sub items of the current item you are currently in using the "list-sub" option that both the printAlbumMenu() and the printPageMenu() feature.
For pages there is also a function named `printSubPagesExcerpts` to list excerpts of the direct sublevel pages of a page.
Please see the documentation for info about that.
If you need that sub item list static independend from the context or anything else you need to build your own function using the class methods.
I'm going to use my gallery like this: 4 main galleries containing subalbums. The 4 main galleries consist of photgraphy, drawings, etc. For each main gallery I want to show a menu with additional text-information in the left column about i.e. photography in general. So I have two situations:
1. The list of pages/links should show up when browsing through gallery 'photography' and all of its subalbums + 2. this menu should stay there once someone clicks on one of those links/pages.
As you can see on the left, there are three subitems for 'Fotografie'. And 'Fotografie' is actually my first main album in the gallery which contains a lot of subalbums. For now I made three ZenPage-pages. In the future I want to make another main ZenPhoto-album 'Drawings' which also contains a lot of subalbums and then a want a few other ZenPage-pages to show up in the left column.
Perhaps there is a way to do this, but then there should be an extra option available for the printPageMenu(), something like printPageMenu('parentID=1') which will show only the subpages of a specified parentpage.
`
set_Context(ZP_ZENPAGE_PAGE);
$_zp_current_zenpage_page = new ZenpagePage("");
printPageMenu("list-sub");
`
Also, somehow the parameters don't work for printPageMenu when I add those lines, so I can't style the active links.
To get the sub page display if your are not on the parent page use it like this:
`
if(is_null($_zp_current_zenpage_page)) {
set_Context(ZP_ZENPAGE_PAGE);
$_zp_current_zenpage_page = new ZenpagePage("Links");
}
printPageMenu("omit-top","","menu-active","submenu","menu-active");
`
Just tried with zenpage-default.
`
$mainalbum = getAlbumLinkURL();
$word = 'fotografie';
$pos = strpos($mainalbum, $word);
// i want to check if the main album (not the main galleryname)
// is /albums/fotografie
if ($pos==true) {
set_Context(ZP_ZENPAGE_PAGE);
$_zp_current_zenpage_page = new ZenpagePage("fotografie");
printPageMenu("omit-top","","menu-active","submenu","menu-active");
} else {
printPageMenu("omit-top","","menu-active","submenu","menu-active");
}
`
For now this seems to work. When in the future I will have a second main album (AND main ZenPagepage) I will have to add a check for this too.
One problem I encountered... The list of links in the sidebar keeps mentioning one page which I'm sure I set to 'unpublished', and this link works. But I don't want it to show up.
EDIT... Sorry, the pagelink was indeed removed, but I could only see it after I logged out...
i have a similar problem creating a navigation. i need to have to seperate navigations (one for the top level pages and one for the sub pages.)
my structure is like this:
top-page1
top-page2
subpage 1
subpage 2
top-page3
right now i use `<?php printPageMenu("list-top","","menu-active","","menu-active"); ?>` to display the toplevel navigation on all pages and `<?php printPageMenu("omit-top","","menu-active","submenu","menu-active");?>` on the subpages and on top-page2 (is hardcoded only in these three pages)
first of all, this isn't good programming style, because i have to add the navigation on every subpage i create - is there a function to determine if a page has a parent or not?
my second problem is, that if i'm on a subpage, the top-level page link doesn't get the active class, so i can't style it the way i want. if i'm on a top-page, it works as it should.
i hope you know, what i mean and can help me with that.
What three pages? If you use Zenpage as intended you have only one theme file for pages, `pages.php`, where you need to add the subpagemenu call. The function does not display anything if there is nothing to display.
I see the issue with the active class of the main menu. The function does indeed not "know" that you are using it as a separate top level function. Have to look if that is doable if set to toplevel display.
Meanwhile you will have to build your own function using `getPages()`, `getParentPages()` and the class methods.
i mean right now i have to add the subpagemenu call in the codeblock, because i need a div wrapper around it. is there a way to determine if a page is a subpage and use it in an if-statement?