We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11105
    • 5 Posts
    Hi,
    Apologies if this has been answered but i couldnt see it.
    I am building a fairly large site that has multiple mini sites inside it.
    We are using contexts to seperate these.

    So basically imagine a corporate site and each department has a ’website’ of their own to do as they want with it. thats what we are trying to achieve.

    And so what we want to do is to have a Site wide menu and a seperate menu which is context sensitive.

    I have the context sensitive menu working (in fact it worked out the box).

    When i build a second menu I cant see a way of telling it to not be context sensitive. Basically all i want from the site menu is each of the mini sites but i would like it to be dynamic if possible (and not some html i wrote with specific ids in that means anytime a new site is added it has to be edited).

    If necessary i can jump in and add this as a feature but i would rather not do something if it exists already smiley

    If i have just missed the thread for this please point me at it and i will be on my way.
    Thanks in advance.
    • Not sure if this is exactly what you’re experiencing, but here’s the cross link:
      http://modxcms.com/forums/index.php/topic,60412.0.html
      • I’m trying to do something similar, however I haven’t gotten Wayfinder to work within a context just yet. Documentation on Wayfinder + Contexts would be great...if I figure it out I’ll post it here.
          [sepiariver.com] (https://sepiariver.com/)
        • Wayfinder seems have no cross-context capabilities. This is a must have feature in the future development.

          For this moment getResources could be sufficient to handle this situation. Maybe by wrapping getResources in another snippet.

          <?php
          /*
           * crossContextMenu Snippet
           * Just a sample wrapping getResources for handling cross-context query
           *
          **/
          
          $snippetProperties = array('parents'=>'40,80,120', 'context'=>'en,de,fr', 'tpl'=>'crossContextMenuChunk');
          $resources = $modx->runSnippet('getResources', $snippetProperties);
          
          $output = '';
          /*
          do some action to the resources from getResources
          */
          return $output;


          Or we can call getResources for each context like below
          <?php
          /*
           * anotherCrossContextMenu Snippet
           * Just another sample wrapping getResources for handling cross-context query
           *
          **/
          
          $contextArray = array('en'=>'40,41,42', 'de'=>'80,81,82', 'fr'=>'120,121,122');
          $resourceArray = array();
          
          foreach ($contextArray as $context => $parents) {
            $snippetProperties = array('context'=>$context, 'parents'=>$parents, 'tpl'=>'crossContextMenuChunk');
            $resourceArray[$context] = $modx->runSnippet('getResources', $snippetProperties);
          }
          
          $output = '';
          /*
          do some action to the resourceArray from getResources
          */
          return $output;
            zaenal.lokamaya
            • 16868
            • 24 Posts
            leekohlbradley Reply #5, 13 years ago
            Wayfinder handles contexts quite nicely post 2.2.0, just use &contexts and &startIdContext. More info here: http://rtfm.modx.com/display/ADDON/Wayfinder#Wayfinder-GeneralParameters

            But...

            What it will not seem to do out of the box is allow you to actually use the output generated. What I mean is, Wayfinder will build a menu, but links to another context will 404.

            Anyone know how to fix this? It’s been killing me for the past several days (!!). I suspect ACL but I don’t have a clue how to work that action yet. huh
            • I simply add a "web link" to the "other" context, as I tend to build contexts as "other" sites. Essentially, this allows a single link in a "global" navigation menu to another context which will have its own "global" navigation with a single weblink back to the "main" context.

              This way the contexts are linked, but also autonomous.
                Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                • 29877
                • 35 Posts
                Quote from: leekohlbradley at Apr 19, 2011, 12:39 PM
                Anyone know how to fix this? It's been killing me for the past several days (!!). I suspect ACL but I don't have a clue how to work that action yet.  huh

                I just came in to using Wayfinder for this scenario today as I continue to build a new site. I encountered the very same problem, but did find a solution: add the "scheme" parameter.

                What I do not know is if part of the functionality of Wayfinder to work correctly across context is broken/unfinished and this a magical work-around to make it work – or if by chance the documentation is lacking and has not indicated to use this.

                Also, one thing that alludes me is the use of the parameter "startIdContext". The documentation gives the description only as "(added in 2.2.0-rc1)".

                At any rate, it seems to work for me and I wanted to share it with the community.


                On pages within Context B of my site I am using the following Wayfinder call to create a menu with links to documents within Context A:

                [[!Wayfinder@Top Navigation? &contexts=`Context A` &scheme=`full`]]


                The piece: "@Top Navigation" loads a Property Set that I created called "Top Navigation". It contains the following parameters: "innerRowTpl", "innerTpl", "level", "outerTpl", "parentRowTpl", "rowTpl", and "startId".
                  • 36613
                  • 328 Posts
                  cristianb88 Reply #8, 8 years ago
                  Quote from: lokamaya at Mar 14, 2011, 01:02 AM
                  Wayfinder seems have no cross-context capabilities. This is a must have feature in the future development.

                  For this moment getResources could be sufficient to handle this situation. Maybe by wrapping getResources in another snippet.

                  <!--?php
                  /*
                   * crossContextMenu Snippet
                   * Just a sample wrapping getResources for handling cross-context query
                   *
                  **/
                  
                  $snippetProperties = array('parents'=-->'40,80,120', 'context'=>'en,de,fr', 'tpl'=>'crossContextMenuChunk');
                  $resources = $modx->runSnippet('getResources', $snippetProperties);
                  
                  $output = '';
                  /*
                  do some action to the resources from getResources
                  */
                  return $output;


                  Or we can call getResources for each context like below
                  <!--?php
                  /*
                   * anotherCrossContextMenu Snippet
                   * Just another sample wrapping getResources for handling cross-context query
                   *
                  **/
                  
                  $contextArray = array('en'=-->'40,41,42', 'de'=>'80,81,82', 'fr'=>'120,121,122');
                  $resourceArray = array();
                  
                  foreach ($contextArray as $context => $parents) {
                    $snippetProperties = array('context'=>$context, 'parents'=>$parents, 'tpl'=>'crossContextMenuChunk');
                    $resourceArray[$context] = $modx->runSnippet('getResources', $snippetProperties);
                  }
                  
                  $output = '';
                  /*
                  do some action to the resourceArray from getResources
                  */
                  return $output;


                  this solution doesn't work in modx revolution with getResource.

                  The solution is pdoResources !