WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • ShowMenu2: Display root level page + child pages from any page
  • Print
Pages: [1]   Go Down

Author Topic: ShowMenu2: Display root level page + child pages from any page  (Read 13554 times)

Offline CodeALot

  • Posts: 579
  • Gender: Male
ShowMenu2: Display root level page + child pages from any page
« on: April 14, 2016, 02:01:58 PM »
I'm probably overlooking something but I can't find it:

I want to display a page-tree from a specific page (say PAGE_ID 5) and the child pages of that specific page.

I know about this solution:
Code: [Select]
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_CURRTREE); but that will only show the page tree of the page I am on at that moment.

What I want is: to show the pagetree of PAGE_ID 5 on any other page as well.

Any ideas?
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #1 on: April 14, 2016, 02:18:45 PM »
Maybe this works?:
Code: [Select]
show_menu2(0, 5, SM2_ALL, SM2_ALL);

Where 5 is the PAGE_ID of the page you want to use as root for the menu.
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #2 on: April 14, 2016, 02:23:37 PM »
Quote from: nibz on April 14, 2016, 02:18:45 PM
Maybe this works?:
Code: [Select]
show_menu2(0, 5, SM2_ALL, SM2_ALL);

Where 5 is the PAGE_ID of the page you want to use as root for the menu.

Hi Nibz,

Well, that is a start since it shows all the child pages of page 5, but not page 5 itself :) But I could solve that with a second call of the menu, showing only root level. Thanks for getting me going again! :-)
Logged

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #3 on: April 14, 2016, 02:29:45 PM »
Do you mean a second menu??  if yes, use the page_id from your start-page instead of SM2_ROOT like this example here



549 is the id of my parent of this 3 subpages, here called as "CDs"
and the second menu is theresult of this menu call here
Code: [Select]
<?php show_menu2(0, 549, SM2_ALL, SM2_ALL,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');?>
Upp, too late  ;-)
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #4 on: April 14, 2016, 02:33:55 PM »
Quote from: jacobi22 on April 14, 2016, 02:29:45 PM
Do you mean a second menu??  if yes, use the page_id from your start-page instead of SM2_ROOT like this example here



549 is the id of my parent of this 3 subpages, here called as "CDs"
and the second menu is theresult of this menu call here
Code: [Select]
<?php show_menu2(0, 549, SM2_ALL, SM2_ALL,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');?>
Upp, too late  ;-)

Help is never too late :)

What I mean is that I want to have a pagetree/menu displaying:

CD's
* CD 1
* CD2
* CD3


on *any* page. So just the pagetree of CD's, including the top level.
Logged

Offline sky writer

  • Posts: 926
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #5 on: April 18, 2016, 06:09:38 AM »
I'm sure you got this figured out by now, but if not, I worked out a simple solution:
Code: [Select]
<?php show_menu2(0, 89, SM2_ALL, SM2_ALL,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');?>
The trick is, 89 is the id of an unused "hidden" (dummy) root parent page of "CDs".  This way the child page "CDs" is shown, and then all children of the CDs page are shown as well.

Hope this helps.
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #6 on: April 18, 2016, 09:24:36 AM »
Thanks, I'll give that one a try too :)
Logged

Offline sky writer

  • Posts: 926
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #7 on: May 13, 2016, 02:14:14 AM »
Did that solution work for you?
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #8 on: May 13, 2016, 10:17:49 AM »
Unfortunately no. I ended up creating different menu-'numbers' for every pagetree and calling them using  show_menu2(1  /  show_menu2(2  /  show_menu2(3 etc. etc.
For this project that worked well enough :)
Logged

Offline sky writer

  • Posts: 926
Re: ShowMenu2: Display root level page + child pages from any page
« Reply #9 on: May 13, 2016, 03:35:00 PM »
Good enough.  Maybe I did not understand your needs.  The solution I posted does this:
Quote from: CodeALot on April 14, 2016, 02:33:55 PM

What I mean is that I want to have a pagetree/menu displaying:

CD's
* CD 1
* CD2
* CD3


on *any* page. So just the pagetree of CD's, including the top level.

In this example, the hidden root page is id3:
<?php show_menu2(0, 3, SM2_ALL, SM2_ALL,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');?>










Is that not what you needed?
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • ShowMenu2: Display root level page + child pages from any page
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2