We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23610
    • 37 Posts
    Hey all,
    I’m playing with Revo and at the moment I’m stuck on PHx -> Filters/Modifiers step.
    I have this code in my template:
      [[*template:is=`2`:then=`
        [[*isfolder:is=`0`:then=`
          [[*description:notempty=`<p>[[*description]]</p>`]]
        `]]
      `]]
    

    And:
      [[*template:is=`2`:then=`Works great`]
    

    First one gives me errors and headache. It displays description but always with `]] at the end of output. Looks like it just don’t work.
    Second example works fine.

    Is it that Revo filters doesn’t support multi-level conditions? Nested on in another?
      • 3749
      • 24,544 Posts
      It might work if you put it all on one line, but conditional modifiers, especially complex ones, are very slow and inefficient. I would use a snippet. Something like this:

      [[!MyDescription]]

      
      <?php
      /* MyDescription snippet */
      
      $output = '';
      $r =& $modx->resource;
      
      if ($r->get('template) == '2') {
          if ($r->get('isfolder') == '0') {
              $d = $r->get('description');
              if (! empty($d) {
                  $output = '<p>' . $d . '</p>';
              }
          }
      }
      
      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
        • 23610
        • 37 Posts
        Quote from: BobRay at Apr 21, 2011, 01:04 AM

        It might work if you put it all on one line, but conditional modifiers, especially complex ones, are very slow and inefficient. I would use a snippet.
        Thank you for reply, BobRay.
        I’ve already tried one line option and it didn’t work.
        I’m very used to PHx conditional modifiers wich worked perfectly on Evo. Now I found this basic technic to be problematic in Revolution. Maybe it is slow and inefficient but I have never experienced that when using it in Evolution. They aren’t that complex and writting snippets for every conditional part is not an option for me.
          • 16337
          • 44 Posts
          Quote from: BobRay at Apr 21, 2011, 01:04 AM

          It might work if you put it all on one line, but conditional modifiers, especially complex ones, are very slow and inefficient. I would use a snippet. Something like this:

          isn’t the slowness only relevant if the page is fully dynamic? e.g. if its cached it shouldn’t matter since its rendered once no?

          thanks for the input..
            • 23610
            • 37 Posts
            Quote from: krisj at May 10, 2011, 02:26 PM

            isn’t the slowness only relevant if the page is fully dynamic? e.g. if its cached it shouldn’t matter since its rendered once no?
            Exactly, once cached it’s fast as typical static (MODX) content.
              • 3749
              • 24,544 Posts
              Yes, but every time you clear the site cache (which happens a lot for me) the first visitor will have to wait.
                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
                • 16337
                • 44 Posts
                which should be redesigned by the way! what about high traffic sites? we should be able to selectively clear the cache of individual resources (and their dependent elements). which brings us into another topic altogether tongue
                  • 23610
                  • 37 Posts
                  Quote from: krisj at May 10, 2011, 05:10 PM

                  we should be able to selectively clear the cache of individual resources (and their dependent elements).
                  And thats a realy nice idea. Sounds like a perfect solutions to me.