We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18373 ☆ A M B ☆
    • 3,141 Posts
    Hello,

    I have a site structure which has three levels.

    1: categories
    .... 2: individual pages
    ........ 3: data pages / explanatory pages (not all individual pages have this level pages, but if one individual page has, say, a ditto feature for a blog, the 3rd level contains the blog posts for that.)

    For usability reasons, there is a sort of submenu to the left of the site which contains different information, depending on the level of the page.

    In level 1 pages, it shows a list of the level 2 pages within the category
    In level 2 pages, it shows a link "Up one level" as well as list of the pages of the same level (=2) in the level 1 category
    In level 3 pages, it currently only shows a link "Up one level".

    For the level 1 pages, this chunk is called to list the pages:
    <div class="box">
    	<div class="box-titel"><h2>[*menutitle*]</h2></div>
    	<div class="box-tekst">[[Wayfinder?startId=`[*id*]` &level=`1`]]</div>
    	<div class="box-onder"><p><a href="[~37~]" title="Sitemap">Sitemap</a></p></div>
    </div>

    As you can see, it adds a title which is the same as the menutitle.

    For the level 2 pages, this chunk is called to list the pages:
    <div class="box">
    	<div class="box-titel"><h2>Ook in deze categorie</h2></div>
    	<div class="box-tekst">
    		<ul><li class="niveauomhoog"><a href="[~[*parent*]~]" title="Niveau omhoog">Niveau omhoog</a></li></ul>
    		[[Wayfinder?startId=`[*parent*]` &level=`1`]]
    	</div>
    	<div class="box-onder"><p><a href="[~37~]" title="Sitemap">Sitemap</a></p></div>
    </div>

    As you can see it shows a static test ’Also in this category’ (but then in Dutch), then the link ’Up a level’, and the rest of the list called by Wayfinder.

    For the level 3 documents, this is the chunk called:
    <div class="box">
    	<div class="box-titel"><h2>Terug</h2></div>
    	<div class="box-tekst">
    		<ul><li class="niveauomhoog"><a href="[~[*parent*]~]" title="Niveau omhoog">Niveau omhoog</a></li></ul>
    	</div>
    	<div class="box-onder"><p><a href="[~37~]" title="Sitemap">Sitemap</a></p></div>
    </div>



    The wayfinder calls simply are a <li> list and the outer is <ul>.


    What I would like to do...
    For the level 1, everything’s fine.

    For the level 2, I would like to be able of using the menutitle of the parent in the title part. And this is where I could use some help XD I expect I need to use a custom snippet... and I went looking for an API function but I could not find a way to read the data of another page.
    I can easily get the parent ID with $modx->documentObject[’parent’] if I understand the API right, so that’s no problem then if I can use that to read the menutitle.


    For the level 3 I’m not sure yet. Open to suggestions :p As there might be a lot of level 3 pages, I don’t want to compile a list of them in a side menu... have to think about it.
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
      • 14197
      • 35 Posts
      To get the document title, use
      $r = $modx->getPageInfo($id,1,’pagetitle’);

      if($r){
      $pagetitle = $r[’pagetitle’];
      }
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        That’s the one I was looking for laugh!


        Too bad it doesn’t allow menutitle according to the wiki page, but I’ll live with pagetitle.


        Thanks a lot!

        [Solved]
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.