We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6318
    • 11 Posts
    Quote from: BobRay at Feb 11, 2011, 12:36 AM

    On the right side of the screenshots, I don’t see this as the first line of your snippet:

    return "Hello from the snippet!";


    Yes, the right side of the screen has nothing to do with it. It is just a text editor with old irrelevant text in it.
      • 3749
      • 24,544 Posts
      That’s very mysterious.

      You put the snippet tag in the Content section of the page, I assume. Is there a [[*content]] tag in the template used by that page?
        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
        • 6318
        • 11 Posts
        Quote from: BobRay at Feb 11, 2011, 02:56 PM

        That’s very mysterious.

        You put the snippet tag in the Content section of the page, I assume. Is there a [[*content]] tag in the template used by that page?

        Yes the [[*content]] tag is in the template. As soon as I remove the UserGroups snippet call from the page, it displays correctly.

          • 3749
          • 24,544 Posts
          Try this version:

          <?php
          /* UserGroups snippet*/

          if ($modx->user->isMember(’membres’) ) {

          $output = $modx->getChunk(’membres’);

          } elseif ($modx->user->isMember(’administrateurs’) ) {

          $output = $modx->getChunk(’administrateurs’);

          } elseif ($modx->user->isMember(’employés’) ) {

          $output = $modx->getChunk(’employés’);

          } else {

          $output = $modx->getChunk(’offline’);

          }

          return $output;
            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
            • 27519
            • 275 Posts
            Did you check the modx error log?

            It’s easy to make a typo with a ";" or a "$".

            Snippets are notoriously difficult to debug...

            If my snippets get too long, I export them from modx to an external file which I can edit/debug with NetBeans. The snippet then only contains an include to the external file. Of course once the snippet is debugged and tested, you can always copy it back into modx.
              MODx Revolution / MAMP / OS X
              • 6318
              • 11 Posts
              Quote from: skndn60 at Feb 11, 2011, 06:08 PM

              Did you check the modx error log?

              It’s easy to make a typo with a ";" or a "$".

              Snippets are notoriously difficult to debug...

              If my snippets get too long, I export them from modx to an external file which I can edit/debug with NetBeans. The snippet then only contains an include to the external file. Of course once the snippet is debugged and tested, you can always copy it back into modx.

              Thanks a lot for your help guys. Unfortunatly, my client simply got mad at me for the delays, so I took a .htaccess approach to my problem. Hope this thread can help someone else.