Show sub-pages in menu always?

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

Comments

  • 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.
  • gwmbox Member
    Ok, I am assuming you mean this part

    `
    foreach ($pages as $page) {
    $pageobj = new ZenpagePage($page['titlelink']);
    $level = max(1,count(explode('-', $pageobj->getSortOrder())));
    $process = (($option == 'list' || $option == 'list-top') && $level==1 // show the top level
    || (($option == 'list' || ($option == 'omit-top' && $level>1))
    && (($pageobj->getID() == $pageid) // current page
    || ($pageobj->getParentID()==$pageid) // offspring of current page
    || ($level <= $mylevel && $level > 1 && strpos($pageobj->getSortOrder(), $myparentsort) === 0)) // direct ancestor
    )
    || ($option == 'list-sub'
    && ($pageobj->getParentID()==$pageid) // offspring of the current page
    )
    );
    if ($process) {
    if ($level > $indent) {
    echo "\n".str_pad("\t",$indent,"\t")."
      \n";
      $indent++;
      $parents[$indent] = NULL;
      $open[$indent] = 0;
      } else if ($level < $indent) {
      $parents[$indent] = NULL;
      while ($indent > $level) {
      if ($open[$indent]) {
      $open[$indent]--;
      echo "\n";
      }
      $indent--;
      echo str_pad("\t",$indent,"\t")."\n";
      }
      } else { // level == indent, have not changed
      if ($open[$indent]) { // level = indent
      echo str_pad("\t",$indent,"\t")."\n";
      $open[$indent]--;
      } else {
      echo "\n";
      }
      }
      `
      Not really sure part to edit, but I am thinking the `$level > $indent` part but not sure?
  • acrylian Administrator, Developer
    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.
  • As to the answer to your question. To show all pages, change the $process line to $process=true. To show all pages to nesting level x change the line to say $process = $level <= x;
  • gwmbox Member
    How easy was that - cheers for the quick solution :)
  • acrylian Administrator, Developer
    Tonight's nightly will also have the parameter $showsubs for this.
Sign In or Register to comment.