We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    I have a structure as below;

    home
    - about
    ----- bla
    --------- blabla
    foods
    ----- pizza
    ----- cheese
    --------- old
    --------- young
    etc..
    contact


    When I'm on page 'foods', or on page 'cheese', or on page 'old' I need to show the pagetitle of page 'foods'.
    I don't think I can use getField / doclink where I need to specify the ID.

    Just show level 0 pagetitle no matter what level you are in.


      Evolution user, I like the back-end speed and simplicity smiley
      • 22840
      • 1,572 Posts
      You could try UltimateParent

      Return the "ultimate" parent of a document

      http://modx.com/extras/package/ultimateparent
        • 4041
        • 788 Posts
        Give this snippet a try, it uses a top level document pagetitle, if not it defaults to current document pagetitle.
        // get the ultimate parent of the current document
        $uparent = $modx->runSnippet( 'UltimateParent', array( 'top'  => 0 ) );
        
        $parent_title = $modx->db->getValue( $modx->db->select( 'pagetitle', $modx->getFullTableName( 'site_content' ), 'id = "'.$uparent.'"' ) );
        
        $pagetitle = $parent_title ? $parent_title : '[*pagetitle*]';
        
        return $pagetitle;
        
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 9995
          • 1,613 Posts
          Thats for Revo but it leeded me to the solution.
          I managed it with the UltimateParent snippet.
          This was actually what I needed: the field description.

          I have a multi language site, this works but could be done with getfield too for non multilanguage sites.
          [[YAMS? &get=`data` &from=`description` &docid=`[[UltimateParent]]`]]


          Thanks Paul smiley
            Evolution user, I like the back-end speed and simplicity smiley
            • 9995
            • 1,613 Posts
            Didn't see your reply Breezer, I will bookmark that one, thanks
              Evolution user, I like the back-end speed and simplicity smiley
              • 13226
              • 953 Posts
              @ fourroses666

              I don't know if this is of interest but here it is anyway:

              I've been experimenting with some of the standard snippets that are packaged with Evo, in particular Wayfinder.

              After so many years of using Wayfinder and being ignorant of its real potential, I read a post about using Wayfinder as a Breadcrumb and from there I experimented further to make a "<title></title>" tag.

              I made a copy of the breadcrumb config (assets/snippets/wayfinder/configs/) renamed it to "title-tag.config.php" and modified it:
              <?php
              $hideSubMenus = 1;
              $fullLink = 0;
              $selfClass = ''; 
              $hereClass = ''; 
              $firstClass = ''; 
              $lastClass = '';
              $textOfLinks  = 'pagetitle';
              $titleOfLinks = '';
              $removeNewLines = 1;
              
              if ($modx->config['site_start'] == $modx->documentObject['id']) {
              	$homeLink = '';
              } else {
              	$homeLink = "{$modx->config['site_name']}";
              }
              
              $outerTpl = "@CODE:{$homeLink} |[+wf.wrapper+]";
              $innerTpl = '@CODE: | [+wf.wrapper+]';
              $rowTpl = '@CODE: '; //Do not change '@CODE: ' - it must stay exactly as it is (with the space), otherwise the breadcrumb breaks
              $activeParentRowTpl = '@CODE:[+wf.linktext+][+wf.wrapper+]';
              $hereTpl = '@CODE:[+wf.linktext+]';
              ?>

              Wayfinder call:
              <title>[[Wayfinder? &startId=`0` &config=`title-tag`]]</title>

              I haven't tried but I am sure you can use other parameters in the config file as well e.g.
              $level = '';
              $includeDocs = '';
              $excludeDocs = '';
                • 9995
                • 1,613 Posts
                Thanks iusemodx, thats also an option indeed.
                it crossed my mind to use wayfinder for this kind of stuff too.
                  Evolution user, I like the back-end speed and simplicity smiley
                  • 13226
                  • 953 Posts
                  Quote from: fourroses666 at Sep 28, 2013, 05:23 PM
                  Thanks iusemodx, thats also an option indeed.
                  it crossed my mind to use wayfinder for this kind of stuff too.

                  No problem smiley

                  I will be updating one of my sites shortly and am trying to reduce snippets where possible - am down to Wayfinder, Ditto & PHX
                  • Actually I am becoming quite dependent on the FastField plugin. It adds another set of tags that you can use, [[#...]] to grab the specified field of the specified resource, or the GET or POST - it's quite versatile.
                    [[#[[UltimateParent]].pagetitle]]
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 13226
                      • 953 Posts
                      Quote from: sottwell at Sep 29, 2013, 03:36 AM
                      Actually I am becoming quite dependent on the FastField plugin.
                      So far as I am aware "FastField" is for "Revo", not "Evo", or am I wrong ?