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

    In the docs (http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/input-and-output-filters-%28output-modifiers%29) we have this for the and modifer:

    Can be used to string output modifiers together with an "AND" relationship.

    But no example and I'm obviously not figuring out:

    [[*template:is=`58`:and:++context_key:is=`corporate`:then=`[[++site_url]][[*alias]][[*isfolder:is=`1`:then=`/`:else=`.html`]]`]]

    Doesn't work. Can anyone provided an example?
      • 3749
      • 24,544 Posts
      It's making me dizzy to think about it. wink

      Here's a snippet that should do the same thing much faster (untested), assuming that I'm understanding your intent. I'm not sure what you want to happen if the conditions are not met:

      $r =& $modx->resource;
      $url = '';
      
      if ( ($r->get('template') == 58) && ($r->get('context_key') == 'corporate') ){
          $suffix = $r->get('isfolder')? '/' : '.html';
          $url = $modx->getOption('site_url') . $r->get('alias') . $suffix;
      }
      return $url;
      
      




        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 25803 ☆ A M B ☆
        • 721 Posts
        Thanks. Will be able to try later. Don't want it to do anything if the conditions are not met. We may switch to querying the access permission of the document and won't need any combinations, i.e. if editable then use a canonical link specific to the context, if protected, then build a canonical link to the context's parent URL, from which the child contexts gets documents syndicated down to it.
          • 3749
          • 24,544 Posts
          I believe that would be:

          (if you're denying it based on the user's Context Access policy)
          if ($modx->hasPermission('edit_document') {
              /* Editable */
          } else {
              /* Not Editable */
          }


          (If you're denying it based on a Resource Group Access policy)

          if ($r->checkPolicy('save')) {
              /* Editable */
          } else {
              /* Not Editable */
          }
          

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting